Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advances In Databases And Information Systems Second East European Symposium Adbis 98 Poznan Poland September 1998 Proceedings Lncs 1475

Authors: Witold Litwin ,Tadeusz Morzy ,Gottfried Vossen

1st Edition

3540649247, 978-3540649243

More Books

Students also viewed these Databases questions

Question

How autonomous should the target be left after the merger deal?

Answered: 1 week ago