logo
Published on Models of Motion (http://www2.evergreen.edu/modelsofmotion)

CS Homework Week 5

1. Complete the program for manipulation of a List/Array

1. Make a simple menu program that will call each function doing the manupulation of the array

2. Make sure your given code for reading from a file works, you can see the read array, and you have a file

3. Implement the first 3 functions doing what is described on the Week 5 lab page [0]

4.  Decide which sort you would like to implement. The Insertion sort is the easiest.  We coded most of this in class
       make sure your program sorts the list successfully.  Do not use the .sort Python extension

THIS IS THE REQUIRED LEVEL FOR THIS ASSIGNMENT.  TRY THE FOLLOWING EXTENSIONS

1.  See if you can implement a faster sort  (quicksort, radixsort)

2.  Implement a Binary Search on your sorted list.  Input a value to find and your function will tell if it is in the list 

2. Complete the Visual Python program to model collisions in 1 dimension. Your progression is the following:

1. Input a mass and velocity. Get the ball to move across the screen at the given velocity

2. Add a second ball to the screen. Get the balls to stop when they just meet each other

3. Add the formula for Collisions found on the website for CS Lab, Week 5, calculating the velocity
of what the balls should be after the collision. Have the balls move off the screen at these 2 new velocities

4. Test: If your 2 masses are the same, the first moving ball should stop and the second ball should
move to the right with the same velocity as the first ball. Experiment with different masses for the balls

THIS IS THE REQUIRED LEVEL FOR THIS LAB. PROCEED WITH THE NEXT 2 CHALLENGES IF YOU HAVE TIME

5. Give the second ball an initial velocity. Check the collision. Use the same formula

6. Have the 2 balls rebound when they get to the end of the screen. Turn the right ball around when it gets
to a positions of, say 10, by chenging its velocity to its negative. Turn the left ball around when it's position
gets to, say, -10. Your balls will continue to bounce off each other indefinately.

THESE 2 EXTENSIONS REQUIRE ONLY A FEW MORE LINES OF CODE

3. Look at the PDF file attached to the Week 5 lab for modeling collision in 2 dimensions

4. Review CS read/write code exam. If you have a 7 or lower on the read or write code competency, study until you are very confident you can do the problems correctly. I will schedule another time to retake the exam.


Source URL:
http://www2.evergreen.edu/modelsofmotion/modelsofmotion/cs-homework-week-5