Sorting and Running Time
Merge Sort
We're going to show that Merge Sort has an O(n lg n) running time by timing the code on the computer.
You need a running version of Merge Sort. Feel free to use the version with the videos or one that was done in class.
- cp ~kurban/public_html/permanent/cpp-examples/mergeSort/* . (for the video one)
- cp ~kurban/public_html/csc125/ (for the live class, the name may vary)
What to do
To time an individual run, create a linked list of some number (say 1,000,000) random elements, and run the code with and look at endTime - startTime. This is one datapoint.
Write a program that will:
- generate at least 200 different data points of various sizes.
- Those points will be written to a 'csv' file. Comma separated value files are text files that can be read into a spreadsheet directly.
- This code should run for HOURS
- You can run it on any machine you want
Overview of the program for loop (at least 200 times)
- Pick a number of items to sort, perhaps based on the outer loop and a random number, lets call it n
- for loop (n times)
? create random number and insert into linked list using ll.insert()
- end while
- start timer
- ll.mergesort()
- end timer
- append n and elapsed time to a data file
end for loop
Tree Parser
Write a c++ cgi script that will parse a program that's passed into it and act of the results. The program is a new, simple language it made up that works with a single queue.
Doodle Bugs Start
Look at the doodlebug problem in the text book:
- Page 888-9 from text. Ex 9 (9th ed)
- Page 863-4 Ex 11 (8th ed)
Rather than just use a console for the interface, lets build a web app that will do it. (Obviously there are better technologies for this!)
This web app just creates a world, it doesn't run the simulation. There's no eating or starving or breeding in this lab.
- I have put the interface together, your job is to add some new classes to the entire program:
- My code is at h ttp://www.csit.parkland.edu/~kurban/permanent/cpp-
e xamples/doodleStart/
on linux, use
cp ~kurban/public_html/permanent/cpp-examples/doodleStart/* .
pond object has a blue water-like image
- You will need to create the class and put in the proper virtual functions required by Organism
- You will need to add a public method to the World constructor called makePond() and call it from the constructor
- The makePond() method will be called from the world constructor after fillBorder() and will make a continuous pond.
- Either it can be rectangular. (Choose two rows and two columns and fill in between them)
- Or it can be round. (Choose a center and a diameter, and points where the distance from the center is < radius is a pond)
- It must be random, so a reset will draw a new one.
A frog object has a colorful frog image (so it can be seen)
- You will need to create the class and put in the proper functions required by Organism
- You will need to add a public method to the world constructor called
makeFrog() and call it from the constructor
- The makeFrog() method will be called from the world constructor after fillDoodleBug() and will make frog with a 1 in 100 probability on an empty square.
- a link to your code in the message area.
- an image of the webpage with a pond and crickets.
Message : My instructor requires use the softwares: CodeBlocks, Putty and Wincp.
Almost codes the instructors given in his files( or link) , you need to change or adjust parts of codes to finish those labs.
We use codeblocks coding and use Linux(putty) to run on my web link
Attachment:- Labs.rar