3 parts, 3 steps a) list of unique ints b) array of objects c) sort the list Must do A before B and B before C - only submit excellent code, stop when you can't - non-working code cancels out all prior versions List of unique integers - command line N, R - generate N numbers in the range 1 to R - terminate if not possible - fill & print list otherwise - time it 100,100 500,500 1000,1000 20000,20000 40000,40000 ./dfree 10 20 10 numbers in range 1 to 20, no dups or print "impossible" Random values; but do set a seed so you can get repeatable Create a class; each object has at least the 5 attributes Now handle an array of these objects Array of objects ( like array of structures ) int key [ unique ] int m string of m random chars int n list of n numbers perhaps m,n sent to constructor but have default as well Now sort the data. Measure it. Bubble sort & Selection sort ( by key ) * size of list [ 1000 50000 ] * values m,n [small 10 med 100 large 1000] -- develop good test cases Arrays & lists should be dynamic, right-sized print 1st & last 3 [ key, 4 chars, 3 ints ] time it
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here