Mind map
Bubble + Merge Sorts
Map content
Bubble + Merge Sorts
bubble
- A bubble sort algorithm goes through a list of data a number of times, comparing two items that are side by side to see which is out of order. It will keep going through the list of data until all the data is sorted into order. Each time the algorithm goes through the list it is called a ‘pass’.
- Imagine that you have a list of people who you want to sort by age, from youngest to oldest. A bubble sort can do this. The list of ages is: 41, 15, 17, 32, 18, 28, 77 and 54 First pass The highlighted numbers are the numbers that are being compared. 41, 15, 17, 32, 18, 28, 77, 54 This is the list before it is sorted. 41, 15, 17, 32, 18, 28, 77, 54 The first two numbers are compared. 15 is smaller than 41 so they switch places. 15, 41, 17, 32, 18, 28, 77, 54 The next two numbers are compared. 17 is smaller than 41 so they switch places. 15, 17, 41, 32, 18, 28, 77, 54 The next two numbers are compared. 32 is smaller than 41 so they switch places. 15, 17, 32, 41, 18, 28, 77, 54 The next two numbers are compared. 18 is smaller than 41 so they switch places. 15, 17, 32, 18, 41, 28, 77, 54 The next two numbers are compared. 28 is smaller than 41 so they switch places. 15, 17, 32, 18, 28, 41, 77, 54 The next two numbers are compared. 41 is smaller than 77 so no change occurs
merge
- Merge sort is a sorting technique based on divide and conquer technique. With worst-case time complexity being Ο(n log n), it is one of the most respected algorithms. Merge sort first divides the array into equal halves and then combines them in a sorted manner.
- An example of merge sort. First divide the list into the smallest unit (1 element), then compare each element with the adjacent list to sort and merge the two adjacent lists. ... In computer science, merge sort (also commonly spelled mergesort) is an efficient, general-purpose, comparison-based sorting algorithm.
Information
- Description
- GCSE Computing Mind Map on Bubble + Merge Sorts, created by Holly Howell on 29/01/2019.
- Created by
- Holly Howell
- Views
- 0
- Rating