Skip to content

kgashok/sortUnix

Repository files navigation

Sort Unix

Run on Repl.it

Click the above "run on repl.it" gray button to launch your own fork on repl.it

What to do?

Once you have successfully forked your own copy of the github repo on repl.it, do the following inside repl.it:

  1. Press the green "run" button above
  2. Observe what happens on the console on the right.

Part 1 - Objectives

"Begin with the end in mind"

  1. Observe how sort command works in Unix
  2. Read strings from text file (names.txt)
  3. Sort the strings and show the output
  4. Add "india" to the names.txt file
  5. Sort the strings again and show the output
  6. Add your name to the file names.txt
  7. Press the "run" button again - see where your name appears in the list

or listen to http://j.mp/unixSortDemo

Files description

  • main.sh - which executes every time you press the green "run" button
  • names.txt - text file to edit your name into

Part 2 - Objectives

"Going from Known to Unknown"

  1. Make sure you know the pseudo code (aka Python) for the Selection Sort algorithm

algo

  1. Review the file selectsort.md
  2. Come prepared to share and write the algorithm on the board
  3. Review the C code for selectsort.c to perform live!

Part 3 - Objectives

"Pre-requisite knowledge is critical"

  1. 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
  2. Make sure you know how strcmp function works. Visit https://www.geeksforgeeks.org/strcmp-in-c-cpp/

  3. How do you swap two numbers without using a third variable?

  4. What is code snippet to swap two character array variables in C?

Part 4 - Challenge yourself!

"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

Part 5 - The Pointer Version!

"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

Part 6 - Advanced Challenge

"Go where no man or woman has gone before!"

code

----

Faculty Notes

Releases

No releases published

Packages

No packages published