Sorting Algorithms - Study Mode
[#481] What is the full form of MSD in MSD radix sort?
Correct Answer
(A) most significant digit
[#482] Sleep sort should be preferred over permutation sort as it has better time complexity.
Correct Answer
(B) false
[#483] Introsort algorithm is combination of . . . . . . . .
Correct Answer
(A) Quick sort and Heap sort
[#484] 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
}
}
Correct Answer
(C) Bidirectional bubble sort
[#485] 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)
}
}
Correct Answer
(B) newElement < node->value