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
Arrays :- To execute a stack we need a variable called top, that holds the index of the top element of stack and an array to hold the part of the stack.

Define neotaxonomy. Discuss how electron microscopy can help in solving a zoological problem faced by taxonomist.

1) What will call a graph that have no cycle? 2) Adjacency matrix of an undirected graph is------------- on main diagonal. 3) Represent the following graphs by adjacency matr

Normally a potential y satisfies y r = 0 and 0 ³ y w - c vw -y v . Given an integer K³0, define a K-potential to be an array y that satisfies yr = 0 and K ³ y w - c vw -y v

HOW LINKED LIST HEADER WORKS? HOW TO INSERT AND DELETE ELEMENTS IN LINKED LIST?

c program to represent a graph as an adjacency multilist form

What are the things require to implement ADT Abstract data types are very useful for helping us understand the mathematical objects which we use in our computations but, of cou

the voltage wave forms are applied at the inputs of an EX-OR gate. determine the output wave form

Q. Using the following given inorder and preorder traversal reconstruct a binary tree Inorder sequence is D, G, B, H, E, A, F, I, C

Q. What is the need of using asymptotic notation in the study of algorithm? Describe the commonly used asymptotic notations and also give their significance.