Question: Q 2 : A ) Use Compiler ( in: C + + ) to create array A = [ d o t s . .

Q2: A) Use Compiler (in: C++) to create array A=[dots..n],
Generate A randomly as follows, then apply insertion and
selection sort for the same generated array:
A=[1dots..n] Insertion sort time Selection sort time
B) Apply insertion sort to sort the string "algorithm" in alphabetical
order
Show each iteration of insertion sort on the string. Find the number
of comparisons
Q3: Prove or disprove
1.5n2+40n+100=O(n2).
2.n31000=O(n2).
3.f(n)=i=1ni2.isf(n)=On3?
4.nk=O2n
5.i=1nlogi=Onlogn
6.7n=(9n)
Q4: In each of the following situations, indicate whether f=
O(g), or f=(g), or both f=Og.
f(n)=n-100 and g(n)=n-200.
f(n)=n12 and g(n)=n23.
f(n)=100n+logn and g(n)=n+(logn)2.
f(n)=10logn and g(n)=log(n2).
f(n)=n2logn and g(n)=n(logn)2.
f(n)=n12 and g(n)=4logn
f(n)=n2n and g(n)=3n.
f(n)=2n and g(n)=2n+1.
Q5: Find the complexity (Exact and approximate) for the
basic operations of the following algorithms:
sum =0;
for (k=1;kn;k**=2)
for Q5: Find the complexity (Exact and approximate) for the
basic operations of the following algorithms:
sum =0;
for (k=1;kn;k**=2)
for (j=1;jn;++j)
sum++;
??2=0;
for (k=1;kn;k**=2)
for (j=1;jk;++j)
sum2++;
int Fun2(int n)
{
if (n0)
return 1 ;
for (int j=0;ji;j++nm(n0)
 Q2: A) Use Compiler (in: C++) to create array A=[dots..n], Generate

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!