Determine the complexity, Data Structure & Algorithms

1)    The set of the algorithms whose order is O (1) would run in the identical time.  True/False

2)    Determine the complexity of the following program into big O notation:

printMultiplicationTable(int max){

for(int i = 1 ; i <= max ; i + +)

{

for(int j = 1 ; j <= max ; j + +) cout << (i * j) << " " ; cout << endl ;

}  //for

3)   Assume the following program segment:

for (i = 1; i <= n; i *= 2)

{

j = 1;

}

Find out running time of the above program segment into big O notation?

 

4)   Prove that if f(n) = n2 + 2n + 5 and g(n) = n2 then f(n) = O (g(n)).

5)   How several times does the given for loop will run

for (i=1; i<= n; i*2)

k = k + 1;

end;

Posted Date: 4/4/2013 6:08:14 AM | Location : United States







Related Discussions:- Determine the complexity, Assignment Help, Ask Question on Determine the complexity, Get Answer, Expert's Help, Determine the complexity Discussions

Write discussion on Determine the complexity
Your posts are moderated
Related Questions
This is a k-ary position tree wherein all levels are filled from left to right. There are a number of specialized trees. They are binary trees, AVL-trees, binary search trees, 2

Q. Define the graph, adjacency matrix, adjacency list, hash function, adjacency matrix, sparse matrix, reachability matrix.

what happen''s in my computer when i input any passage

The maximum degree of any vertex in a simple graph with n vertices is (n-1) is the maximum degree of the vertex in a simple graph.

write a program that find,search&replace a text string

Give example of assertion and abstract data type For illustration, consider Natural ADT whose carrier set is the set of non-negative integers and whose operations are the usual

I need a recursive algorithm to implement the FIRST function to any grammar

Illustrate an example of algorithm Consider that an algorithm is a sequence of steps, not a program. You might use the same algorithm in different programs, or express same alg

Q. Write down an algorithm to merge the two sorted arrays into the third array. Do  not perform the sort function in the third array.                           Ans: void m

Depth-first traversal A depth-first traversal of a tree visit a node and then recursively visits the subtrees of that node. Likewise, depth-first traversal of a graph visits