Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please help me with this questions. Thank you. [50] Short Answer 1.[10] Give (A)

ID: 3800629 • Letter: P

Question

Please help me with this questions. Thank you.

[50] Short Answer

1.[10] Give (A) a name of one of the comparison-based sorting algorithm and

(B) its asymptotic upper bound (O) of running time in the worst case.

2.[10] What is the smallest number of internal nodes of a heap of height h? Explain your answer by drawing a heap.

3.[10] In a proper binary tree, prove that e 2h where e is the number of external nodes and h is the height of tree.

4.[10] For a given record of 100 patients, you’re trying to sort the patients according to their birth of date () in non-decreasing order: e.g.) 19890605 (i.e. 1989-June-5th). What do you think is the best sorting algorithm to sort the records? Justify your answer.

5.[10] Decide the asymptotic upper bound (O) of f(n) and prove it by the definition of big-Oh.

Explanation / Answer

Answer 1

Bubble sort is one of the example of comparison based sorting algorithm.

It sorts the array by comparing each element with the remaining other.

The complexity of the bubble sort is O(n) as there are it take square time to solve and sort the array.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote