Giter Site home page Giter Site logo

sortstep's Introduction

Sorting

In this assignment you will write a program that tests 4 different sorting algorithms: Bubble, Selection, Insertion, and Merge sort. You will write a Stopwatch class that uses System.nanoTime() to measure the time each algorithm takes to sort 1000, 2000, 4000, and 8000 integers.

Suggested steps to complete this assignment

  1. Fork and clone down this repository.
  2. Run the program. You should see the following output:
    Testing Bubble Sort
    Bubble Sort took 0 microseconds
    Testing Selection Sort
    Selection Sort took 0 microseconds
    Testing Insertion Sort
    Insertion Sort took 0 microseconds
    Testing Merge Sort
    Merge Sort took 0 microseconds
  3. First, use System.nanoTime() to complete the Stopwatch class
  4. Then, starting with bubblesort, complete the 4 sorting functions in the Sorts class
  5. (Note that you do not need to add any code to the SortStep program)
  6. Test each sorting algorithm for the time it takes to sort 1000, 2000, 4000 and 8000 integers, and write your answers on the handout for the assignment. You should run the tests several times and record the best time for each. You can change the number of integers by changing the initialization of the private numInts variable in SortStep.pde.
  7. When you are finished, submit the sorting handout to the schoolloop drop box. (Note that is not necessary to submit your code for the assignment).
  8. If you have extra time, you might try to improve the efficiency of your merge sort. Also, feel free to add other sorts like quick sort or gnome sort to the program.

sortstep's People

Contributors

simart avatar philiphuang2 avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.