Which of the following are the worst-case running times of insertion sort, merge sort, and quick sort respectively?

a. O(n^2), O(n log n), and O(n^2)
b. O(nlog(n)), O(nlog(n)), and O(n^2)
c. O(n^2), O(n^2), and O(n log(n))
d. O(n^2), O(n log(n)), and O(n log(n))


Insertion sort takes O(n^2) in worst case, as we need to run two loops. Merge sort takes O (n log(n)) time in all cases. Quick sort takes O(n^2) in worst case.

Computer Science & Information Technology

You might also like to view...

Which of the following statements is false?

a) XAML is an XML vocabulary. b) XAML markup is readable by both humans and computers, so you can manually write XAML to define your GUI. c) When you compile your app, a XAML compiler generates code to create and configure controls based on your XAML markup. d) XAML a version of Visual Basic

Computer Science & Information Technology

In computer science, abstraction is used for ignoring or hiding details that are nonessential.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

How do you access the Style Inspector?

A. Click the Style Inspector button at the bottom of the Styles task pane. B. Click the Style Inspector button in the Styles group. C. Click the Change Styles button, then click Style Inspector. D. Click the Style Inspector button in the Styles gallery.

Computer Science & Information Technology

Case Based Critical Thinking ? Case 1 ? Roman and Trisha have a company that provides entertainment for birthday parties. Since business is a little slow, they decided to create an exciting website using several media enhancements to increase interactivity and interest. ? Roman and Trisha know that they can use Flash to add interest to their site in several ways except for the following:

A. Increase the number of hits their site receives by attracting more crawlers B. Create and add more interesting navigation buttons C. Add short videos of their performers at work D. Add an interactive talent roster that uses sound

Computer Science & Information Technology