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
What is Algorithm A finite sequence of steps for accomplishing some computational task. An algorithm should Have steps which are simple and definite enough to be done

multilist representation of graph

How does cpu''s part tming and controls generate and controls signls in computer?

Q. The reason bubble sort algorithm is inefficient is that it continues execution even after an array is sorted by performing unnecessary comparisons. Therefore, the number of comp

What are the Objectives of visual realism applications After studying this unit, you should be able to know specific needs of realism, add realism to pictures by el

This notation gives an upper bound for a function to within a constant factor. Given Figure illustrates the plot of f(n) = O(g(n)) depend on big O notation. We write f(n) = O(g(n))

explain quick sort algorithm

(1) Sort a list of distinct numbers in ascending order, using the following divide- and-conquer strategy (Quicksort): divide the list of numbers into two lists: one that contains a

Determine the class invariants- Ruby Ruby has many predefined exceptions classes (like ArgumentError) and new ones can be created easily by sub-classing StandardError, so it's

Data Structure and Algorithm 1. Explain linked list and its types. How do you represent linked list in memory? 2. List and elucidate the types of binary tree. 3. Descr