Question: Q5 Answer the following questions. (Marks 12) If array elements are 8, 22, 7, 9, 31, 5, 13, what will be the total number of

Q5

Answer the following questions. (Marks 12)

  1. If array elements are 8, 22, 7, 9, 31, 5, 13, what will be the total number of swaps needed to sort the numbers by using bubble sort sorting algorithm?
  2. What is time complexity of bubble sort when array is already sorted?
  3. What is similarity between efficiency of selection sort and bubble sort as long as the time complexity is concerned?
  4. If array elements are 14, 33, 27, 35, 10, what will be the order of elements?
  5. Let suppose swap operation is very costly in a particular situation. Which sorting algorithm should be used such that the number of swaps are reduced? Support your answer using appropriate example. You may use pseudo code representation.
  6. Consider insertion sort, selection sort, merge sort and quick sort algorithms. Arrange them in order with respect to their time Complexity in the best case?

please answers all these short question dont leave anyone.

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!