Machine Learning @Purdue
Fall 2011: STAT 598Z: Introduction to Computing for Statisticians
Read about insertion sort from
. We will implement it in Python in our lab.
Create an array of 10 random integers
Start with an empty list
Choose the i-th element from the array and insert it into the appropriate position in the list
Repeat for all elements in the array
Copy the sorted list into an array and output it
Check that the resulting array is sorted
Recall the merge sort algorithm that we implemented in class. We used recursion for our implementation.
Try to implement merge sort without recursion. This is quite tricky to do in practice. So think before you implement your algorithm. Do not look for solutions in Google!
Check that your algorithm is correct by running it on an array of 10 random integers.
Back to top
courses/fall2011/598z/lab/week12.txt · Last modified: 2011/12/01 11:16 by vishy