1. For n, enter the number of entries you wish to add to the list 2. Repeat n times: enter a number into the list 3. Press Space to sort the list Extra info: Insertion Sort is a simple sorting algorithm that runs in O(n^2), or quadratic time. Despite its mediocre performance on large lists, insertion sort IS stable and only uses O(1) extra space.
Feel free to remix or use in your projects. Being able to sort lists is fundamental to numerous algorithms/scripts. One such use is finding the MEDIAN for a list of observations: 1. Enter all inputs and press space (sort the list) 2. If n is ODD, then the median is the number at index (n/2) rounded up 3. If n is EVEN, then the median is the average of numbers at index (n/2) and (n/2 + 1) Please comment below if you would like me to include the Java or C code. #sort #sorting #list #insertion #java #programming #code