Question: Secition 1 Answer All Questions Question 1 : Consider the following numbers 7,2,10,12,1,16,4 a) State the complexity of the selection sort and quick sort. Sort

 Secition 1 Answer All Questions Question 1 : Consider the followingnumbers 7,2,10,12,1,16,4 a) State the complexity of the selection sort and quicksort. Sort the numbers using selection sort and quick sort. Which algorithmis better (3 Marks) b) Write a method that sort an array

Secition 1 Answer All Questions Question 1 : Consider the following numbers 7,2,10,12,1,16,4 a) State the complexity of the selection sort and quick sort. Sort the numbers using selection sort and quick sort. Which algorithm is better (3 Marks) b) Write a method that sort an array using selection sort method (2 Marks) c) Write a method that pushes an element into stack array of integers. State its complexity (2 Marks) d) Write a two methods to calculate the range in a collection of numbers either array of linkedlist). State their complexities (3 Marks) 2 Question 2 a) Let an unordered array A, ordered array B, a linked list L, binary search tree, hash table H and minimum heap HP. All contains n elements. What is the complexity (number of steps) of the following operations: (4 Marks) Complexity Operation Delete the first element from L Delete the last element from A Find an element in B Find a maximum value in T Insert an element in H Determine the height of T Sort A using bubble sort method Insert an element into HP b) Whats the return value for following methods: (3 Marks) int ml(int n) { if(n==4){ return 2; } else { return 2 * ml(n + 1); } int m2(int m, int n) { if (m == n) { return n; } else if (m

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!