GithubHelp home page GithubHelp logo

sort-compare's Introduction

Comparisons of Sorting Algorithms

Algorithms

  • Bubble sort
  • Insertion sort
  • Selection sort
  • Quick sort
  • Merge sort
  • Heap sort

Comparison Result

After applying sorting algorithms on different sizes of data, we have the following table. The cost time is in seconds.

Algorithm 10 samples 100 samples 1000 samples 10000 samples 100000 samples
Bubble Sort 0.000001021 0.000080346 0.00683811 0.731437 70.5418
Insertion Sort 0.000000824 0.000046901 0.00469361 0.440733 44.146
Selection Sort 0.000000811 0.000027316 0.00194979 0.188101 18.9768
Quick Sort 0.000000743 0.000010898 0.000150127 0.00201223 0.0242033
Merge Sort 0.000018431 0.000105988 0.00118194 0.0139549 0.152184
Heap Sort 0.000005781 0.000045861 0.000537181 0.0068288 0.0800461

Usage

Take bubble sort as an example, if you want to get the cost time of sorting 1000 samples, try the following code.

#include "sortingAlgorithms.h"

int main() {
    SortComp sc(1000);
    double costTime = sc.runBubbleSort();
    return 0;
}

sort-compare's People

Contributors

humberto1015 avatar

Watchers

 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.