GithubHelp home page GithubHelp logo

time-complexity-of-sorting-algorithms's Introduction

Time-Complexity-of-Sorting-Algorithms

For Assignment 1 of CS245: Data Structures and Algorithm with Professor Brizan.

Sort Interface is implemented by each sorting algorithm, which contains functions sort(<double_array>) and isSorted(<double_array>). By uncommenting the main method in Sort.java, the runtime result of the six sorting algorithms in milliseconds will be printed to console.

To run Sort.java: java Sort <desired-array-length>

Navigate to the Issues tab to read more about the time complexities of these sorting algorithms.

time-complexity-of-sorting-algorithms's People

Contributors

kleeio avatar

Watchers

James Cloos avatar  avatar

time-complexity-of-sorting-algorithms's Issues

Time Complexity of Merge Sort and In-Place Merge Sort

The graph below demonstrates the runtime of Merge sort versus an In-Place Merge sort, which is constant in space complexity. As expected, In-Place Merge sort which requires a merge function that is θ(n^2), whereas merge function in Merge sort is θ(log(n)), which resulted in a far higher runtime than Merge Sort has.

Time Complexity of Merge Sort vs  In-Place Merge Sort

Time Complexity between Fundamental Sorting Algorithms

Using the sorting algorithms: Selection sort, Bubble sort, Insertion sort, Merge sort, and Quick sort, identical copies of arrays between lengths 100,000 and 1,000,000 to each sorting algorithm and the resulting runtime is printed. The below graph displays each sorting algorithms runtime efficiency in milliseconds for a given array length.

Time Complexity of Fundamental Sorting Algorithms

As shown in the graph, bubble sort had the longest running time of the five sorting algorithms, whereas quick sort had the shortest.

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.