Advertisement

Insertion Sort Algorithm

Insertion Sort Algorithm This is the first of two videos about the insertion sort. This video describes the insertion sort algorithm. The insertion sort is rather like sorting a hand of playing cards. The insertion sort is particularly good for lists that are nearly sorted already, or when you just want to insert a single item into a list that is already in order. For example, the high score board of a game would be a good candidate for an insertion sort. This video illustrates how a pointer variable separates the sorted and unsorted sections of a list. It shows how the pointer advances from left to right, making each item in the unsorted section the current item, as the insertion sort progresses. The current item is compared with each item in the sorted section, in turn, and sorted items are moved if necessary until the current items can be inserted into the correct position. The insertion sort is a little faster than a bubble sort but, like the bubble sort, the insertion sort struggles with very large amounts of data. The video that follows this one includes pseudocode for the insertion sort algorithm.

programming,computer science,computing,coding,code,insertion sort,algorithm,pseudocode,bubble sort,A Level,GCSE,

Post a Comment

0 Comments