6) Using Big O notation, give the amount of time it takes to do the following op
ID: 3558910 • Letter: 6
Question
6) Using Big O notation, give the amount of time it takes to do the following operations. (10 Pts.) (A1) Sorting a list of N names stored in an array using Bubble sort. (1.5 points) (B1) Sorting a list of N names stored in an array using Quick/Merge sort. (1.5 points) (C1) Find a specific Name in a singly linked list of N items. (1.5 points) (D1)Find a specific number in an array of N items using binary search. (1.5 points) (E1) The following function when it is called. (4 Pts.) public float Fun ( int N, Scanner KB) { float sum = 0,T ; for ( int I = 0 ; IExplanation / Answer
a) Sorting a list of names stored in an array using bubble sort takes O(N^2) time.
b) Sorting a list of names stored in an array using quick/merge sort takes O(NlogN) time.
c) Finding a specific name in a singly linked list of N items takes O(N) time.
d) Finding a specific number in an array of N items using binary search takes O(logN) time.
e) This function takes O(N^3) time.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.