QuesAns Print Page – CSKC
Sign In

Search

siteicon
Q&A CBSE12D-2015-B03A #6533

Question:

What will be the status of the following list after fourth pass of bubble sort and fourth pass of selection sort used for arranging the following elements in descending order ?
14, 10, -12, 9, 15, 35

Answer:

Bubble Sort
       14,10,-12,9,15,35 (Original Content)
    i. 14,10,9,15,35,-12
   ii. 14,10,15,35,9,-12
  iii. 14,15,35,10,9,-12
   iv. 15,35,14,10,9,-12 (Unsorted status 
                      after 4th pass)
Selection Sort
       14,10,-12,9,15,35 (Original Content)
    i. 35,10,-12,9,15,14
   ii. 35,15,12,9,10,14
  iii. 35,15,14,9,10,-12
   iv. 35,15,14,10,9,12