Search the courses, subjects, tracks, games and features, or jump straight to a page.
2 cards from this section. Quick, good the night before a test.
What is the purpose of merging in the merge sort algorithm?
Think about how you would sort two stacks of cards.
State the base case for the merge sort algorithm.
Consider when no sorting is needed.
What is the time complexity of merge sort?
Think about how many splits and merges occur.
True or False: Merge sort is unstable, meaning it does not preserve the input order of equal elements.
Consider examples with duplicate elements.
Given two sorted arrays A = [1, 3, 5] and B = [2, 4, 6], write a function to merge them without using additional arrays.
Think about how to use indexes of each array to insert elements directly.
Create a visual representation of the merge sort algorithm applied to the array [12, 11, 13, 5, 6, 7]. Describe the merge steps as you go.
Document each comparison during the merging process to illustrate the order.
4 more questions in this section. Enroll free to practise them all.
Enroll free