Q.1) What it the Bog O of the following equation?

10n3 + 24n2 + 3n log n + 144

O(n^3)

O(10n^3)

O(n^2)

O(n)

Q.2) What it the Bog O of the following equation?

n2 + n log n + 50

O(n)

O(n^2)

O(log n^2)

Q.3) What it the Bog O of the following equation?

5 log2n + 15 log n

O(n)

O(log n)

O(1)

Q.4) Exponential identity:

(ab)n = an + bn

True

False

Q.5) Match the following Big O notation with their respective operation.

O(1)

[ Choose ]

O(log n)

[ Choose ]

O(n)

[ Choose ]

O(n^2)

[ Choose ]

Q.6) What is the Big-O of the code snippet below?

# include

int main()
{
printf(“Hello World”);
}

O(Cn)

O(n)

O(1)

O(n^2)

Q.7) What is n in the pseudocode below? What is the Big-O?

Pseudocode:

list_Sum(A,n) {

total =0

n = 8000

for i=0 to n-1

sum = sum + A[i]

return sum

}

n; O(1)

8000; O(A,i)

8000; O(n)

8000; O(n^2)

Q.8 ) Exponential identity:

aman = amn

True

False

Q.9) Logarithm identity:

logb M + logb N = logb (M/N)

True

False

Q.10) Say your and your coworkers write an algorithm that takes in an array of numbers and returns the highest one, select the the three (3) best analysis below that describes your algorithm.

The absolute slowest it can run is Linear time – O(n)

The absolute fastest it can run in Quadratic time – Ω(n^2)

The absolute fastest it can run is Linear time – Ω(n)

The absolute slowest it can run is constant time time – O(c)

This algorithm be tightly asymptotically bound – so we can also say it’s Θ(n)

Q.11) Match the analysis for Mileage problem:

How much gas does it take to go 200 miles?

Straight, downhill, wind at your back

[ Choose ]

“Average” terrain

[ Choose ]

Winding, uphill, gravel road, inclement weather

[ Choose ]

[ Choose ]

Q.12) Divide and Conquer

Divide ==> solve the problem recursively.

Conquer ==> put the problem into a number of sub-problems.

Combine ==> put the problem into one solution to give a solution to the original problem.

True

False

Q.13) Heap Sort:

Build the initial heap from the following array

[10, 16, 54, 17, 19, 65, 31]

Note: minimum 300 words.

Q.14) Heap Sort – max heap:

Build the initial heap from the following array

[10, 16, 54, 17, 19, 65, 31]

a. Show (draw) the max heap with the INITIAL max value

a. Show (draw) the max heap AFTER the FIRST max value is removed

b. Show (draw) the max heap AFTER the SECOND max value has been removed

Note: minimum 300 words

Q.15) what is the Worst case time complexity of quicksort?

O(n log n)

O(n^2)

O(n)

Q.16) In Quick sort, the pivot can be any value within the array being sorted, commonly the value of the middle array element.

True

False

Q,17) MERGE SORT:

Draw a diagram showing the merge sort of the following array.

[5 2 4 7 1 3 2 6]

Q.18) In heap sort – Max heap parents are larger/higher in value that the children

In heap sort – Min heap children are larger/higher in value than the parent

In quick sort – The parents are larger/higher in value that the children

True

False

Q.19) RESEARCH QUESTION:

Solving the traveling salesman problem via brute-force search.

1. Explain the traveling salesman problem
2. Find an C++, or Python algorithm to solve the salesman problem (list information with an example)
3. What is the Big O?

**Not the number of points

Note: Minimum 500 words.

Explanation & Answer length: 1100 Words

2 attachments
Slide 1 of 2

attachment_1
attachment_1

attachment_2
attachment_2

UNFORMATTED ATTACHMENT PREVIEW