Git Product home page Git Product logo

sorting-algorithms's Introduction

Sorting-Algorithms

This is a comparison of the performance of some of the most popular sorting algorithms:

  1. Quick Sort
  2. Merge Sort
  3. Selection Sort
  4. Bubble Sort (Sightly optimised to need less than n(n-1)/2 comparisons for sorting an array of n elements)

Files

  1. Sort.h contains the function prototypes
  2. Sort.c contains the function definitions
  3. Driver.c contains the main function that is used to benchmark the aforementioned sorting algorithms
  4. Run.sh is a shell script used to compile and run the benchmark as well as plot a graph of the observations
  5. Plot.py is a python script that graphs the observations using matplotib.pyplot and numpy

Output Directory Structure

The Analytics Folder contains the output graphs as well as four subfolders (one for each sorting algorithm). These folders inturn have two more subfolders:

  1. Element-to-Element-Comparisons-Only - Contains observations about the algorithm when only element to element comparisons are considered as the basic task.
  2. Including-Loop-Comparisons - Contains observations about the algorithm when all comparisons (including loop condition evaluation) are considered as the basic task.

The following graph is obtained when the algorithms are run for various input sizes considering element to element comparison as the basic task Graph

Dependencies

  • A C++ compiler (e.g., GCC)
  • Python 3 with the following additional modules:
    • Numpy
    • Matplotlib

Compiling and Running the Benchmark

Clone the repository using:

$ git clone https://github.com/Dhruval360/Sorting-Algorithms.git

Execute the Run.sh script using:

$ chmod +x Run.sh
$ ./Run.sh

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.