Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Algorithms

EasyMedium
123456789101112131415161718
Question 8

A merge sort algorithm is used to sort a list of numbers into ascending order.

The initial unsorted list is: 6, 2, 8, 3, 7, 1, 5, 4

Complete the diagram to show the merge sort algorithm at each stage of the division and merging processes.

                  [6, 2, 8, 3, 7, 1, 5, 4]
                            /  \
             [6, 2, 8, 3]          [7, 1, 5, 4]
               /      \              /      \
          [6, 2]      [8, 3]    [7, 1]      [5, 4]
          /   \        /   \    /   \        /   \
         [6]  [2]    [8]   [3] [7]  [1]     [5]
          \   /        \   /    \   /        \   /
          [_, _]      [_, _]    [_, _]      [_, _]
               \      /              \      /
             [_, _, _, _]          [_, _, _, _]
                            \  /
                  [1, 2, 3, 4, 5, 6, 7, 8]

Fill in the missing sublists for the three merging stages.

[5]

Algorithms Questions

  1. IGCSE
  2. /Computer Science
  3. /Algorithms