Skip to content

imsadanala/algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 

Repository files navigation

Algorithms

this repo will have basic sorting algorithms and data structures code

SORTING ALGORITMS

  1. Bubble Sort - time complexity is O(n^2)
  2. Selction Sort - time complexity is O(n^2)
  3. Insertion Sort - Whenever we move element, make sure left side of the elements should be sorted and also time complexity is O(n) when you have most of the elements are sorted- O(n^2)

Time Complexity

TimeComplexity Name Example

1	                  Constant	          Insertion/Deletion from LinkedList

log^n	              Logarithmic	        Finding an element in Sorted Array

n	                  Linear	            Finding an element in UnSorted Array

nlog^n	            LinearLogarithmic   Sorting items by "Divide and Conquer"- Merge Sort

n^2	                Quadratic	          Shortest path between two nodes in a graph

n^3	                Cubic	              Matrix Multiplication

2^n	                Exponential	        The Tower of Hanoi problem

A. Search

  1. UnOrdered List
    a. Best case, knowing the index of the element that you then it is O(1)
    b. Worst case, O(n)

  2. Ordered List a. O(log^n base2)

B. Insertion/Deletion

  1. Ordered list
    a. Worst case, O(n)
    b. Best case, O(1)

About

this repo will have basic sorting algorithms and data structures code

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages