Flashcards on Merge sort

Merge Sort Explained: A Comprehensive Guide for Students

1 / 20

What is Merge Sort?

Merge Sort is a highly efficient, general-purpose, comparison-based sorting algorithm.

Tap to flip · Swipe to navigate

Merge Sort Algorithm

20 cards

Card 1

Question: What is Merge Sort?

Answer: Merge Sort is a highly efficient, general-purpose, comparison-based sorting algorithm.

Card 2

Question: What algorithmic design paradigm is Merge Sort based on?

Answer: Merge Sort is based on the 'divide and conquer' paradigm.

Card 3

Question: What are the three main steps of the 'divide and conquer' approach in Merge Sort?

Answer: The three main steps are Divide, Conquer, and Combine (Merge).

Card 4

Question: Describe the 'Divide' step in Merge Sort.

Answer: The unsorted list is divided into n sublists, each containing one element. A list with a single element is inherently sorted.

Card 5

Question: Describe the 'Conquer' step in Merge Sort.

Answer: Each sublist is recursively sorted. In practice, this step involves repeatedly splitting the list in half until individual elements are reached.

Card 6

Question: Describe the 'Combine (Merge)' step in Merge Sort.

Answer: The sublists are repeatedly merged to produce new sorted sublists until there is only one sorted list remaining.

Card 7

Question: What is the base case for the recursion in Merge Sort?

Answer: If the array has 0 or 1 element, it is already sorted.

Card 8

Question: What happens after the array is fully divided into single-element sub-arrays in Merge Sort?

Answer: The algorithm begins the 'merge' phase, combining these sub-arrays back together in sorted order.

Card 9

Question: What is the role of the `merge` function in Merge Sort?

Answer: The `merge` function takes two already sorted sub-arrays and combines them into a single, larger sorted array.

Card 10

Question: How does the `merge` function combine two sorted sub-arrays?

Answer: It compares the first elements of both sub-arrays, picks the smaller one, and adds it to the result array. This process continues until all elements f