answersLogoWhite

0

📱

Computer Science

Computer Science is the systematic study of algorithmic processes that describe and transform information. It includes the theoretical foundations of information and computation and the practical techniques of applying those foundations to computer systems. Among the many subfields of Computer Science are computer graphics, computer programming, computational complexity theory, and human-computer interaction. Questions about Computer Science, terms such as algorithms and proofs, and methodologies are encouraged in this category.

1,839 Questions

Time and space complexities of various sorting methods?

Bubble sort-O(n*n)-in all cases

Insertion sort-O(n*n)-in avg and worst case in best case it is O(logn)

Quick Sort-0(nlogn)-in avg n best case and 0(n*n)-in Worst case

selection sort-same as bubble

Linear search-o(n)

Binary Search-o(nlog)

Any doubt mail me-jain88visionary@rediffmail.com

What commands clear the computers memory?

When you turn it off, all memory is lost. You usually end up with pseudo-random patters.

To actively clear all mem would require a machine language program ... which would be wiped in the process.

Who made FORTRAN?

John Backus, who died March 17 of this year, led the team that developed Fortran at IBM in 1954.

What is the differences between Telnet and FTP?

The Difference Between a File Server & an FTP Server

Function

o File servers store data for an entire network, just as an individual computer's hard drive stores data for that individual computer. File Transfer Protocol (FTP) servers run an FTP application to exchange files over the Internet, which is the world's largest network.

Similarities

o File serving and FTP serving are both networking methods that involve file transfer between computers. FTP servers need to work together with file servers in order to function. In a network using FTP, file servers store data while FTP servers transmit that data over the Internet, with both being necessary for file transfer to occur.

    Differences

    o FTP servers download files from or upload files to file servers. FTP servers move files to and from file server locations. FTP servers require file servers, but file servers do not require FTP servers, since file servers also serve various intranet networks not connected to the Internet.

    http://www.ehow.com/facts_6885629_difference-file-server-ftp-server.html

    -RLSB

    What is the C code for preemptive priority scheduling?

    #include<stdio.h>

    #include<conio.h>

    int main()

    {

    char p[10][5],temp[5];

    int i,j,pt[10],wt[10],totwt=0,pr[10],temp1,n;

    float avgwt;

    clrscr();

    printf("enter no of processes:");

    scanf("%d",&n);

    for(i=0;i<n;i++)

    {

    printf("enter process%d name:",i+1);

    scanf("%s",&p[i]);

    printf("enter process time:");

    scanf("%d",&pt[i]);

    printf("enter priority:");

    scanf("%d",&pr[i]);

    }

    for(i=0;i<n-1;i++)

    {

    for(j=i+1;j<n;j++)

    {

    if(pr[i]>pr[j])

    {

    temp1=pr[i];

    pr[i]=pr[j];

    pr[j]=temp1;

    temp1=pt[i];

    pt[i]=pt[j];

    pt[j]=temp1;

    strcpy(temp,p[i]);

    strcpy(p[i],p[j]);

    strcpy(p[j],temp);

    }

    }

    }

    wt[0]=0;

    for(i=1;i<n;i++)

    {

    wt[i]=wt[i-1]+et[i-1];

    totwt=totwt+wt[i];

    }

    avgwt=(float)totwt/n;

    printf("p_name\t p_time\t priority\t w_time\n");

    for(i=0;i<n;i++)

    {

    printf(" %s\t %d\t %d\t %d\n" ,p[i],pt[i],pr[i],wt[i]);

    }

    printf("total waiting time=%d\n avg waiting time=%f",tot,avg);

    getch();

    }

    How do you convert decimal number 93 to binary?

    To convert any number in any base to another base, simply iteratively divide by the second base, using the rules of arithmetic for the first base, recording the remainders in reverse order, until the quotient is zero. For example, answering the question of how to convert 9310 to 10111012...

    93 divided by 2 is 46 remainder 1

    46 divided by 2 is 23 remainder 0

    23 divided by 2 is 11 remainder 1

    11 divided by 2 is 5 remainder 1

    5 divided by 2 is 2 remainder 1

    2 divided by 2 is 1 remainder 0

    1 divided by 2 is 0 remainder 1

    The answer, reading the remainders from bottom to top, is 10111012.

    This was not a good example, because the answer is palindromic, and can be read the same way forwards and backwards. Here is another example, converting 3710 into 1001012.

    37 divided by 2 is 18 remainder 1

    18 divided by 2 is 9 remainder 0

    9 divided by 2 is 4 remainder 1

    4 divided by 2 is 2 remainder 0

    2 divided by 2 is 1 remainder 0

    1 divided by 2 is 0 remainder 1

    The answer is 1001012.

    Program for linear search?

    A simple Binary Search Algorithm is as follows:

    Calculate the mid element of the collection.

    Compare the key items with the mid element.

    If key = middle element, then we return the mid index position for the key found.

    Else If key > mid element, then the key lies in the right half of the collection. Thus repeat steps 1 to 3 on the lower (right) half of the collection.

    Else key < mid element, then the key is in the upper half of the collection. Hence you need to repeat the binary search in the upper half.

    for get program copy link ( babaplayer.blogspot .com/2021/07/binary-search-using-divide-and-conquer.html )

    Which language is predecessor to C programming language?

    hi everyone..

    predecessor to C is B..

    don think it's a joke..

    in UNIX OS , the assembly code was machine dependent..

    so,the version could not be portable..

    so Ken Thompson rewrite the whole UNIX code in the new language called B..

    But B missed several necessary aspects for real life programming..

    so, Ritchie invented the new language called C which solved the inadequacies of B..

    that's all...

    be happy.. be cool..

    What are reallife applications of graphs in data structures?

    Applications of graph theory are primarily, but not exclusively, concerned with labeled graphs and various specializations of these.

    Structures that can be represented as graphs are ubiquitous, and many problems of practical interest can be represented by graphs. The link structure of a website could be represented by a directed graph: the vertices are the web pages available at the website and a directed edge from page A to page B exists if and only if A contains a link to B. A similar approach can be taken to problems in travel, biology, computer chip design, and many other fields. The development of algorithms to handle graphs is therefore of major interest in computer science. There, the transformation of graphs is often formalized and represented by graph rewrite systems. They are either directly used or properties of the rewrite systems(e.g. confluence) are studied.

    A graph structure can be extended by assigning a weight to each edge of the graph. Graphs with weights, or weighted graphs, are used to represent structures in which pairwise connections have some numerical values. For example if a graph represents a road network, the weights could represent the length of each road. A digraph with weighted edges in the context of graph theory is called a network.

    Networks have many uses in the practical side of graph theory, network analysis (for example, to model and analyze traffic networks). Within network analysis, the definition of the term "network" varies, and may often refer to a simple graph.

    Many applications of graph theory exist in the form of network analysis. These split broadly into three categories. Firstly, analysis to determine structural properties of a network, such as the distribution of vertex degrees and the diameter of the graph. A vast number of graph measures exist, and the production of useful ones for various domains remains an active area of research. Secondly, analysis to find a measurable quantity within the network, for example, for a transportation network, the level of vehicular flow within any portion of it. Thirdly, analysis of dynamical properties of networks.

    Graph theory is also used to study molecules in chemistry and physics. In condensed matter physics, the three dimensional structure of complicated simulated atomic structures can be studied quantitatively by gathering statistics on graph-theoretic properties related to the topology of the atoms. For example, Franzblau's shortest-path (SP) rings. In chemistry a graph makes a natural model for a molecule, where vertices represent atoms and edges bonds. This approach is especially used in computer processing of molecular structures, ranging from chemical editors to database searching.

    Graph theory is also widely used in sociology as a way, for example, to measure actors' prestige or to explore diffusion mechanisms, notably through the use of social network analysis software.

    Likewise, graph theory is useful in biology and conservation efforts where a vertex can represent regions where certain species exist (or habitats) and the edges represent migration paths, or movement between the regions. This information is important when looking at breeding patterns or tracking the spread of disease, parasites or how changes to the movement can affect other species.

    What are the advantages of a language processor system in which compiler produces assembly language rather than machine language?

    The main advantage is that it gives the programmer the opportunity to examine the resultant assembly and manually optimise the code. A mature compiler can often produce high quality machine code, however there are still some rare but non-trivial cases where manual intervention is required to achieve optimal performance.

    What is weak semaphore and strong semaphore?

    strong semaphores specify the order in which processes are removed from the queue, which guarantees avoiding starvation. Weak semaphores do not specify the order in which processes are removed from the queue.

    What is meant by the complexity of an algorithm?

    Complexity of an algorithm is the study of how long a program will take to run, depending on the size of its input & long of loops made inside the code

    Specifically, the complexity of an algorithm is a measure of how long it takes to complete (give an answer) relative to increasing sizes of input data. Thus, complexity is not concerned with how long it took the algorithm to run using X amount of data. Rather, it is concerned with the relationship in runtime when using X amount of data, 2X amounts of data, 10X amounts of data, etc. While complexity usually refers to execution time, it can also be applied to other resource usage (for example, memory allocation). In all cases, complexity is concerned with the relationship between the rate of increase in resource consumption and the rate of increase of the size of the data set being worked on.

    Complexity is closely related to the concepts of scalingand efficiency, but is NOT an exact equivalence to either.

    Four step that are necessary to an a program an a completely dedicated machine?

    i. Reserve Machine Time;

    ii. Manually Load the program into the memory.

    iii. Load the starting address and begin execution.

    iv. Monitor and control execution through the use of Console.

    What is the Swift programming language?

    Swift is an Apple programming language for iOS, macOS, watchOS, tvOS and Linux. It is a general-purpose, multi-paradigm, compiled programming language which can inter-operate with C, C++ and Objective-C code in the same program.

    What is it called when a criterion is true if either individual criterion is true?

    Criteria is true if either individual criterion is true is called "or" in Logic. (Criteria is plural form of criterion)

    How do you convert a 4 input NOR gate into multiple 2 input NOR gate?

    you will need 2 two input AND gates to do this. connect the output of the first to one input of the second. you now have a three input AND gate.

    just remember when calculating timing that 2 inputs of the 3 have twice the gate delay of the remaining input, thus the output will have skew and possibly glitches. if timing is critical or glitching can't be tolerated it may be best to use an actual three input AND instead of kludging one.

    What is a compiler and an interpreter?

    a compiler translates an entire program and then executes it while an interpreter translates and executes one line of a program at time

    Why multithreaded programming is beneficial over single threaded programming?

    Not having multithreading is like only having one arm and one gram of brain tissue. Multithreading is essential to computer application operation.

    Multithreading allows a computer to:

    * Distribute processing power over various applications, allowing multiple programs to run at the same time. * Allow a program to run non-essential processes in the background while the main application continues to run normally without hold-ups. * Manage timing of different events without making the process too complicated. For example, say that you have an application that does text editing and plays music. You would want to run the text editor part and the music playing part on separate threads, because otherwise, when the text editor got to a computation-intensive stage, the music would be slower, and when the text editor was idle, the music would be faster.

    This is also what allows the computer to run multiple applications at once. If the computer could not distribute processing power over multiple applications, then you could not run multiple instances of a text editor, or an internet browser, or really anything. Really, nothing would be possible because the system resources would monopolize the processor.

    In reality, this is how the processor handles threads: it goes around and devotes some time to each one, then moves on to the next. It "rounds the bases" so fast, like a cathode ray tube TV, that we don't notice the different. Duel (and triple, and quad, etc.) core processors allow one to split the applications and their corresponding threads to operate on different processors, affecting how much processing power they each receive.

    Advantage and disadvantage of graphical user interface?

    A graphical user interface (GUI) provides a more natural way for a user to communicate with a computer, through the use of pictures clickable menus, file folders, icons and many other more natural methods of being able to get your job done. When compared to a Cmmand line interface (CLI) there is a much smaller learning curve to get the job done.

    What is are advatages and disadvatages of bresenham's line algorithm?

    1. High accuracy. Comparing to Basic Incremental algorithm (especially if the slope were > 1.) 2. High speed. Comparing to Digital Differenmtial algorithm. 3. Draws the line between any two points. Comparing to Basic Incremental algorithm which can't draw if x0 > x1 ( the format is: (x0, y0), (x1, y1). )

    How many programming languages does the average computer scientist know?

    Humans do not write programs using computer language (machine code) we use symbolic programming languages. This wasn't always the case, of course, but humans were speaking "human language" long before we learned to program computers. Without that simple ability we wouldn't be able to communicate with each other let alone invent a programmable machine.

    Write an Algorithm for multiplication table of an integer?

    int firstNumber,secondNumber

    for(firstNumber = min; firstNumber <= max; firstNumber++);

    {

    for(secondNumber = min; secondNumber <=max; secondNumber++);

    int result firstNumber * secondNumber;

    }