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
Unlike a binary-tree, each node of a B-tree may have a number of keys and children. The keys are stored or saved in non-decreasing order. Each key has an related child that is the

The first assignment in this course required you to acquire data to enable you to implement the PHYSAT algorithm (Alvain et al. 2005, Alvain et al. 2008) in this second assignment

Define the term - Array A fixed length, ordered collection of values of same type stored in contiguous memory locations; collection may be ordered in several dimensions.

that will determine the volume of the sphere or the volume of cone or volume of pyramid depending on the choice of the user

Q. Convert the given infix expression into the postfix expression (also Show the steps) A ∗ (B + D)/ E - F(G + H / k ) Ans. Steps showing Infix to Post fix

Linked lists are among the most common and easiest data structures. They may be used to implement various other common abstract data types, including queues, stacks, symbolic expre

Q. Can a Queue be represented by circular linked list with only one pointer pointing to the tail of the queue? Substantiate your answer using an example. A n s . Yes a

how do we use 4-discs stack to solve tower of hanoi problem and write an algorithm to solve it?

Determine about the unreachable code assertion An unreachable code assertion is an assertion that is placed at a point in a program that shouldn't be executed under any circum

Diffuse Illumination Diffuse illumination means light that comes from all directions not from one particular source. Think about the light of a grey cloudy day as compared to