3.
Why is insertion sort preferred over other sorting algorithms (like selection sort, bubble sort etc.) for Tim sort implementation?

7.
Which of the following code fragment puts sorted values in an array using beads correctly?

for (int i = 0; i < n; i++) 
{ 
         int j;
        for (j = 0; j < max; j++); 
        //max is the maximum value element of given array a[]  
        a[i] = j; 
i}

for (int i = 0; i < n; i++) 
{ 
         int j;
        for (j = 0; j < max && beads[i * max + j]; j++); 
        //max is the maximum value element of given array a[]
        a[i] = j; 
}

for (int i = 0; i < n; i++) 
{ 
         int j;
        for (j = 0; j < beads[i * max + j]; j++); 
       //max is the maximum value element of given array a[]  
        a[j] = i; 
}

for (int i = 0; i < n; i++) 
{ 
         int j;
        for (j = 0; j < max && beads[i * max + j]; j++); 
       //max is the maximum value element of given array a[]  
        a[j] = i; 
}

9.
Permutation sort works by . . . . . . . .

Read More Section(Sorting Algorithms)

Each Section contains maximum 100 MCQs question on Sorting Algorithms. To get more questions visit other sections.