Starting from:
$35

$29

Homework 1 Solution

READ Chapters 1 and 2 of “grokking algorithms” – try all exercises, but do NOT turn in!



[All the problems I assign from the book are fair game on the final]






















Homework


Do not Google for a solution – figure it out yourself


Program selection sort in C
    • you can use 2 arrays as we discussed here or 1 array as in the video
    • sort a list of 100 random integers, each integer in the range of 0 to 99

    • be prepared to allow for duplicate integers!
    • [I suggest you test on a smaller size array (like 10) and then expand to 100]

Quick tutorial on how to generate random numbers in C:
https://www.dummies.com/programming/c/how-to-generate-random-numbers-in-c-programming/
Full description of the rand() function:

https://www.tutorialspoint.com/c_standard_library/c_function_rand.htm


CS 5006 - Algorithms - Summer 2020    129





Sample screenshot for homework

































CS 5006 - Algorithms - Summer 2020    130





Homework


Please upload to Canvas your C program and screen shot of you executing the program.


For this homework assignment, you may (if you choose) work in teams of 2.


Each student is expected to work WITH the other student while writing and testing (via ZOOM or whatever collaboration tool you like). Do not split the task between the two of you.


Each student should upload the program/screen shot


The comment at the top of the program should say if it was done by a team and who the two members of the team were (so that the TAs do not have to grade the same homework twice).


More products