11. Which of the following version of tree sort will have the highest worst case time complexity?
12. In average case Heap sort is as efficient as the Quick sort.
13. Quick sort uses which of the following method to implement sorting?
14. LSD radix sort is in-place sorting algorithm.
15. What is the average case time complexity of cube sort?
16. The gap between two elements being compared shrinks by a factor of . . . . . . . . after every iteration.
17. The following function represents which sorting?
void Sorting(int a[], int n)
{
bool swap = true;
int first = 0;
int last = n - 1;
while (swap)
{
swap = false;
for (int i = first; i < last;i++)
{
if (a[i] > a[i + 1])
{
swap(a[i], a[i + 1]);
swap = true;
}
}
if (!swap)
break;
swap = false;
--last;
for (int i = last - 1; i >= first; i--)
{
if (a[i] > a[i + 1])
{
swap(a[i], a[i + 1]);
swap = true;
}
}
++first;
}
}
void Sorting(int a[], int n)
{
bool swap = true;
int first = 0;
int last = n - 1;
while (swap)
{
swap = false;
for (int i = first; i < last;i++)
{
if (a[i] > a[i + 1])
{
swap(a[i], a[i + 1]);
swap = true;
}
}
if (!swap)
break;
swap = false;
--last;
for (int i = last - 1; i >= first; i--)
{
if (a[i] > a[i + 1])
{
swap(a[i], a[i + 1]);
swap = true;
}
}
++first;
}
}
18. What is the best case time complexity of odd-even sort?
19. The insert() procedure, given below, builds the BST on the input elements, which is the first step of the binary tree sort. Choose the correct to fill the condition.
void insert(Tree* node, int newElement)
{
if(node== NULL)
{
node = createNewNode();
node-> value = newElement;
node -> left = NULL;
node -> right = NULL;
return;
}
else if(__________________)
{
insert(node->left, newElement);
}
else
{
insert(node->right, newElement);
}
}
void insert(Tree* node, int newElement)
{
if(node== NULL)
{
node = createNewNode();
node-> value = newElement;
node -> left = NULL;
node -> right = NULL;
return;
}
else if(__________________)
{
insert(node->left, newElement);
}
else
{
insert(node->right, newElement);
}
}
20. What is the worst case time complexity of binary insertion sort?
Read More Section(Sorting Algorithms)
Each Section contains maximum 100 MCQs question on Sorting Algorithms. To get more questions visit other sections.