Skip to content

In this repo we implement in C language the most popular sorting algorithms

Notifications You must be signed in to change notification settings

juansedev/sorting_algorithms

 
 

Repository files navigation

0x1B. C - Sorting algorithms & Big O - Bash

The simplest definition I can give for Big-O notation is this:

Big-O notation is a relative representation of the complexity of an algorithm.

There are some important and deliberately chosen words in that sentence:

relative: you can only compare apples to apples. You can't compare an algorithm to do arithmetic multiplication to an algorithm that sorts a list of integers. But a comparison of two algorithms to do arithmetic operations (one multiplication, one addition) will tell you something meaningful; representation: Big-O (in its simplest form) reduces the comparison between algorithms to a single variable. That variable is chosen based on observations or assumptions. For example, sorting algorithms are typically compared based on comparison operations (comparing two nodes to determine their relative ordering). This assumes that comparison is expensive. But what if the comparison is cheap but swapping is expensive? It changes the comparison; and complexity: if it takes me one second to sort 10,000 elements, how long will it take me to sort one million? Complexity in this instance is a relative measure to something else.
Reference stackoverflow: What is a plain English explanation of “Big O” notation?

📁 Files

## File Description
1 README.md Readme.
2 0-bubble_sort.c Bubble Sort Algorithm
3 0-O Big O notations of the time complexity of the Bubble Sort Algorithm
4 1-insertion_sort_list.c Insertion Sort Algorithm
5 1-O Big O notations of the time complexity of the Insertion Sort Algorithm
6 2-selection_sort.c Selection Sort Algorithm
7 2-O Big O notations of the time complexity of the Selection Sort Algorithm
8 3-quick_sort.c Quick Sort Algorithm
9 3-O Big O notations of the time complexity of the Quick Sort Algorithm

Usage

Download:

Clone the repository with the command line interface:

git clone https://github.com/laucavv/sorting_algorithms.git

Compilation:

Compile .c files with:

gcc -Wall -Werror -Wextra -pedantic file.c -o file

Execution:

user@ubuntu:~/sorting_algorithms$ ./file

By:

Juan Sebastian Llano Gallego

twitter_page linkedin_page medium_page

Laura Villan

twitter_page linkedin_page medium_page

Made with ❤️ in

Flow chart

Holberton School - Colombia

Foundations - Low-level programming & Algorithm ― Data structures and Algorithms

June, 2020.

About

In this repo we implement in C language the most popular sorting algorithms

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 100.0%