Click the above "run on repl.it"
gray button to launch your own fork on repl.it
Once you have successfully forked your own copy of the github repo on repl.it
, do the following inside repl.it:
- Press the green "run" button above
- Observe what happens on the console on the right.
"Begin with the end in mind"
- Observe how sort command works in Unix
- Read strings from text file (names.txt)
- Sort the strings and show the output
- Add "india" to the names.txt file
- Sort the strings again and show the output
- Add your name to the file names.txt
- Press the "run" button again - see where your name appears in the list
or listen to http://j.mp/unixSortDemo
main.sh
- which executes every time you press the green "run" buttonnames.txt
- text file to edit your name into
"Going from Known to Unknown"
- Make sure you know the pseudo code (aka Python) for the Selection Sort algorithm
- practice the http://j.mp/selectionSortCC - Python exercise on CloudCoder
- Review the file
selectsort.md
- Come prepared to share and write the algorithm on the board
- Review the C code for
selectsort.c
to perform live!
"Pre-requisite knowledge is critical"
-
If a character array is of length 15, what is the range of the valid index values?
- 0 to 15
- 1 to 15
- 1 to 14
- 0 to 14
- None of the above
-
Make sure you know how
strcmp
function works. Visit https://www.geeksforgeeks.org/strcmp-in-c-cpp/ -
How do you swap two numbers without using a third variable?
-
What is code snippet to swap two character array variables in C?
"I find that I don’t understand things unless I try to program them."
— Donald E. Knuth, The Art of Computer Programming, Volume 4
Listen to http://j.mp/unixSortKey video series. - Or if you prefer images http://j.mp/selectSortC
Write code along the same steps on http://j.mp/selectionSortC and pass all the test cases - If you practice well, and compete in the liveCoding session, and finish all the test cases < 6 min, you can win upto Rs 1,000 worth of gift prizes - Be among the First 3 to complete to maximize your prize money
"Learning algorithms without implementing them is like learning surgery based solely on reading an anatomy book." - Alexander S. Kulikov and Pavel Pevzner
And if you can complete the pointer version of the code within 6 min, and answer questions on the code, you can win upto Rs 3,000 worth of gift prizes
- To really grok the algorithm in the pointer version, launch the visualizer and single step through it - http://bit.ly/visualSort
- Be among the Best 3 to complete the challenge to maximize your prize money
"Go where no man or woman has gone before!"
- A more efficient SelectionSort using MinMax values - https://www.geeksforgeeks.org/sorting-algorithm-slightly-improves-selection-sort/
-
Selection sort as a series of photos http://j.mp/selectSortC
-
video descriptions
- Using cards to simulate selection sort http://j.mp/selectionSortVideo
- Selection visualization on PythonAnywhere http://bit.ly/selectionVideo2
-
C visualizer for SelectionSort http://bit.ly/visualSort and http://bit.ly/visualSortVideo
-
Space repetition on Memcode http://bit.ly/memCodeC