Skip to content

This repository provides JavaScript implementations of essential data structures (stacks, queues, trees, graphs) and algorithms (sorting, searching, recursion, DP) with clear explanations. Each implementation includes Big-O analysis and practical examples, making it ideal for interview prep and core CS concepts. The code follows modern JavaScript s

Notifications You must be signed in to change notification settings

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

This repository provides JavaScript implementations of essential data structures (stacks, queues, trees, graphs) and algorithms (sorting, searching, recursion, DP) with clear explanations. Each implementation includes Big-O analysis and practical examples, making it ideal for interview prep and core CS concepts. The code follows modern JavaScript s

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published