Skip to content

tanaliga100/data_structures_and_algorithm

Repository files navigation

Data Structures and Algorithm in - JS

Algorithm

  • sets of well defined instructions to solve a particular problem
  • A steps || can be procedural or functional
  • Characteristics = has the data to be manipulated
  • one problem can be solved in different alogrithms
  • every algo comes with its own tradeoffs when it comes to perfomrance
  • Big-O Notation|| worst case complexity
  • BIG - O || Simulation using Objects
  • insert = O(1)
  • remove = O(1)
  • access = O(1)
  • search = O(n) || linear
  • Object.keys() = O(n) = return an array of all the keys in objects
  • Object.values() = O(n) = return an array of all the values in objects
  • Object.entries() = O(n) = return an array of all the elements in the object [key, value]
  • BIG - O || Simulation using Arrays
  • insert = O(1)
  • remove at the end of an array = O(1)
  • remove at the beginning of the array = O(n) linear because index has to be reset
  • access = O(1)
  • searching = O(n)
  • pop/push = O(1)
  • shift/unshift/concat/splice/slice = O(n)
  • forEach/map/filter/reduce = O(n)

About

data_structures_&_algo || Javascript

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published