Determine the complexity, Data Structure & Algorithms

Assignment Help:

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;


Related Discussions:- Determine the complexity

Present the algorithm of binary search. , B i n a ry Search Alg...

B i n a ry Search Algorithm is given as follows 1. if (low > high) 2.     return (-1) 3. mid = (low +high)/2; 4. if ( X = = a [mid]) 5.      return (mid); 6.

Algorithm, Example of worse case of time

Example of worse case of time

Merge sort, #question. merging 4 sorted files containing 50,10,25,15 record...

#question. merging 4 sorted files containing 50,10,25,15 records will take time?

Two-dimensional array, Two-dimensional array is shown in memory in followin...

Two-dimensional array is shown in memory in following two ways:  1.  Row major representation: To achieve this linear representation, the first row of the array is stored in th

Branch and Bound method, give some examples of least cost branch and bound ...

give some examples of least cost branch and bound method..

Depth first search, DEPTH FIRST SEARCH (DFS) The approach adopted into ...

DEPTH FIRST SEARCH (DFS) The approach adopted into depth first search is to search deeper whenever possible. This algorithm frequently searches deeper through visiting unvisite

All pairs shortest paths, N = number of rows of the graph D[i[j] = C[i][...

N = number of rows of the graph D[i[j] = C[i][j] For k from 1 to n Do for i = 1 to n Do for j = 1 to n D[i[j]= minimum( d ij (k-1) ,d ik (k-1) +d kj (k-1)

Prims algorithm, how to implement prims algorithm dynamically

how to implement prims algorithm dynamically

Data structure arrays, In this unit, we learned the data structure arrays f...

In this unit, we learned the data structure arrays from the application point of view and representation point of view. Two applications that are representation of a sparse matrix

Need help with working out. I dont really get it, Suppose there are exactly...

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

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd