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

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;

}

How do you find the time complexity of a given algorithm?

Time complexity gives an indication of the time an algorithm will complete its task. However, it is merely an indication; two algorithms with the same time complexity won't necessarily take the same amount of time to complete. For instance, comparing two primitive values is a constant-time operation. Swapping those values is also a constant-time operation, however a swap requires more individual operations than a comparison does, so a swap will take longer even though the time complexity is exactly the same.

What are the difference between greedy algorithm and dynamic programing?

A greedy algorithm is similar to a dynamic programming algorithm, but the difference is that solutions to the subproblems do not have to be known at each stage; instead a "greedy" choice can be made of what looks best for the moment.

What is worst case and average case complexity of linear search algorithm with explanation?

For a list with n elements, the expected cost is the same as the worst-case cost, which is O(n). The average cost will be O(n/2). However, if the list is ordered by probability and geometrically distributed, the complexity becomes constant, O(1). Compare with a binary search which has a cost of O(log n).

How do you implement 1 bit sliding window protocol progamme in c?

server side:

#include<sys/types.h>

#include<netinet/in.h>

#include<arpa/inet.h>

#define SIZE 4

main()

{

int std, lfd, len, i, j, status, sport;

char str[20], frame[20], temp[20], ack[20];

struct sockaddr_in saddr, caddr;

printf("Enter the port address");

scanf("%d", &sport);

std = socket(AF_INET, SOCK_STREAM, 0);

if(std<0)

perror("Error");

bzero(&saddr, sizeof(saddr));

saddr.sin_family = AF_INET;

saddr.sin_addr.s_addr = htonl(INADDR_ANY);

saddr.sin_port = htons(sport);

lfd = bind(std, (struct sockaddr *)&saddr, sizeof(saddr));

if(lfd)

perror("Bind Error");

listen(std, 5);

len = sizeof(&caddr);

lfd = accept(std, (struct sockaddr *)&caddr, &len);

printf("Enter the text:");

scanf("%s", str);i = 0;

while(i<strlen(str))

{

memset(frame, 0, 20);

strncpy(frame, str+i, SIZE);

printf("\nTransmitting frames:");

len = strlen(frame);

for(j=0; j<len; j++)

{

printf("%d", i+j);

sprintf(temp, "%d", i+j);

strcat(frame, temp);

}

write(lfd, frame, sizeof(frame));

read(lfd, ack, 20);

sscanf(ack, "%d", &status);

if(status 0)write(std, "-1", sizeof("-1"));

else{printf("Enter the sequence no of the frame where error has occured");

scanf("%s", err);

write(std, err, sizeof(err));

read(std, str, 20);

printf("Received the transmitted frame: %s\n", str);

}

}

close(std);

}

What is the difference between an algorithm and java code?

In Java programming language, an algorithm refers to a sequence of instructions that have been specified to undertake a particular task within a certain time. An algorithm can take no or several inputs but will generate at least one output.