Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++. Show the following (make sure you show all the steps). (15 points) n 3 2n + log 2 n (n 2 ) 4n

IN C++.

  1. Show the following (make sure you show all the steps). (15 points)
  2. n3 2n + log2 n (n2)
  3. 4n + 2n log2 n (n log2 n)
  4. 7log2 n2 O(log2 n)
  5. Sort the sequence of integers { 2 ,5 ,4 , 6 , 3, 7, 8, 1} (show steps, do not write code) (20 points)

Using

  1. Heapsort
  2. MergeSort
  1. Sort the same sequence as question 2 using Quicksort. (15 points)
  1. The following algorithm finds the maximum and minimum element of an array (a[ ]). (20 points)

void MaxMin (int a[ ], int n, int max, int min)

{

int maxm, minm;

maxm=minm=a[0];

for (int j=1; j < n; j++)

{

if (a[j] > maxm)

maxm = a[j];

if (a[j] < minm)

minm = a[j];

}

max = maxm; min=minm;

}

  1. Find the Worst and Average cases in term of the basic operations (comparison of two elements).
  2. Find the order and the worst and average cases.
  1. Solve the following recurrence relation in terms of n assuming n=2k (15 points)

W(n) = 2 W(n/2) + n/2

W(1)=0

  1. Define the following Graph Theoric terms (15 points)
  1. A Graph=(V,E)
  2. A Subgraph G=(V,E) of a graph G=(V,E)
  3. A tree T=(V,E).

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

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions

Question

What are the various career paths that individuals may use?

Answered: 1 week ago

Question

Tell the merits and demerits of Mendeleev's periodic table.

Answered: 1 week ago