ASLawan / sorting_algorithms

This repo contains code submitted for the sorting algorithms and Big O project in c

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

0x1B. C - Sorting algorithms and Big O

This program was based on sorting algorithms and Big O notation.

sorting Algorithms

A sorting algorithm is a defined procedure for arranging a set of
data elements in a particular order. This order can be ascending
(smallest to largest), descending (largest to smallest), or based
on custom criteria defined for the specific data type. Sorting
algorithms are fundamental building blocks in various computing tasks,
from organizing user interfaces to processing large datasets in machine
learning and scientific computing.

Here are some key characteristics of sorting algorithms:

  • Time complexity.
  • Space complexity.
  • Stability.
  • Adaptability.

Big O Notation

Big O notation is a mathematical tool used to describe the asymptotic
upper bound of the complexity of an algorithm with respect to its input size.
In simpler terms, it tells you how much the running time or resource usage of
an algorithm grows as the input size increases indefinitely.

Here are some key aspects of Big O notation:

  • Upper bound.
  • Asymptotic behavior.
  • Common notations:
    • O(1): Constant time, the algorithm's time doesn't depend on
      the input size.
    • O(n): Linear time, the time grows proportionally to the input size.
    • O(n log n): Log-linear time, the time grows slightly slower than
      the input size (logarithmically).
    • O(n^2): Quadratic time, the time grows much faster than the
      input size (squared).
    • O(log n): Logarithmic time, the time decreases as the input size increases.

Understanding Big O notation is crucial for analyzing the efficiency of algorithms
and choosing the most suitable one for a specific task, especially when dealing with
large datasets. It helps make informed decisions about what algorithms to use in
various situations and avoid wasting resources on inefficient ones.

Project Tasks

Task O - Bubble Sort

In this task, we implement a function that sorts an array of
integers using the bubble sort algorithm.

Task 1 - Insertion Sort

This task implements a function that sorts a doubly linked list
of integers using the insertion sort algorithm.

Task 2 - Selection Sort

Here, a function is implemeted that sorts in ascending order,
an array of integers, using the selection sort algorithm.

Task 3 - Quick Sort

Lke task 2, task 3 does the same thing but using the quick sort
algorithm. To implement this function, use was made of the
Lomuto Partion Scheme.

About

This repo contains code submitted for the sorting algorithms and Big O project in c


Languages

Language:C 100.0%