Answered step by step
Verified Expert Solution
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++.
- Show the following (make sure you show all the steps). (15 points)
- n3 2n + log2 n (n2)
- 4n + 2n log2 n (n log2 n)
- 7log2 n2 O(log2 n)
- Sort the sequence of integers { 2 ,5 ,4 , 6 , 3, 7, 8, 1} (show steps, do not write code) (20 points)
Using
- Heapsort
- MergeSort
- Sort the same sequence as question 2 using Quicksort. (15 points)
- 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;
}
- Find the Worst and Average cases in term of the basic operations (comparison of two elements).
- Find the order and the worst and average cases.
- 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
- Define the following Graph Theoric terms (15 points)
- A Graph=(V,E)
- A Subgraph G=(V,E) of a graph G=(V,E)
- A tree T=(V,E).
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started