Frequency counts for all statements, Data Structure & Algorithms

Evaluate the frequency counts for all statements in the following given program segment.

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

for (j = 1; j ≤ i; j++)

for (k =1; k ≤ j; k++)

y ++;

Ans.

S1:  for (i=1; i<= n; i++) S2:  for (j=1; j,= i; j++)

S3 : for (k=1; k<= j; k++) S4 : y++;

Frequency counts of

S1=n

S2 = 1+ (1+2)+ (1+2+3) +....... (1+2+....n)

S3 = 1+ [ 1+ (1+2)] + .....[ 1+ (1+2) +....

(1+2+3+...n)]

S4= same as S3.

Posted Date: 7/12/2012 8:26:43 AM | Location : United States







Related Discussions:- Frequency counts for all statements, Assignment Help, Ask Question on Frequency counts for all statements, Get Answer, Expert's Help, Frequency counts for all statements Discussions

Write discussion on Frequency counts for all statements
Your posts are moderated
Related Questions
Primitive Data Structure These are the basic structure and are directly operated upon by the machine instructions. These in general have dissimilar representations on different

Q. The given values are to be stored in a hash table 25, 42, 96, 101, 102, 162, 197 Explain how the values are hashed by using division technique of hashing with a table

Construct a B+ tree for the following keys, starting with an empty tree.  Each node in the tree can hold a maximum of 2 entries (i.e., order d = 1). Start with an empty root nod

With the help of a program and a numerical example explain the Depth First Traversal of a tree.

Q. What do you understand by the term sparse matrix? How sparse matrix is stored in the memory of a computer? Write down the function to find out the transpose of a sparse matrix u

Q. Write down an algorithm to sort a given list by making use of Quick sort method. Describe the behaviour of Quick sort when input given to us is already sorted.

Suppose there are exactly five packet switches (Figure 4) between a sending host and a receiving host connected by a virtual circuit line (shown as dotted line in figure 4). The tr

When there is requirement to access records sequentially by some key value and also to access records directly by the similar key value, the collection of records may be organized

A significant aspect of Abstract Data Types is that they explain the properties of a data structure without specifying the details of its implementation. The properties might be im

(a) Discuss the role played by Business Intelligence Systems in giving companies strategic advantage. (b) Explain the term heuristics searching . (c) With the use of an appr