CS173: Intro to Computer Science - Insertion Sort (3 Points)
Developed by Professor Tralie and Professor Mongan.Exercise Goals
The goals of this exercise are:- To swap two variables in memory
- To implement the insertion sort algorithm
Welcome to our online modules system!
Be sure to log in with your Urinus ID
before you proceed.
For example, Professor Tralie's ID is ctralie.
If you are not an Ursinus student, that's fine!
Just make something up, and you can still run everything
This exercise [1] was developed by Prof. Tralie.
Hints
- If you just say
arr[i] = arr[j]
, then that will do half of the swap, but now you’ve overwritten whatarr[i]
used to be, so you’ve lost the information you need to updatearr[j]
. Try creating a temporary variable to store the value inarr[i]
before you overwite it with what’s inarr[j]
.
-
Developed by Prof. Chris Tralie ↩