Skip to content

Sabbir2809/data-structure-and-algorithms-with-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Structure & Algorithms with JavaScript

An algorithm is a set well-defined instructions to solve a particular problem. Well defined inputs & outputs. Each step should be clear & unambiguous. The same algorithm with the same programming language can be implemented in different ways.

Why Algorithms?

  • As a developer, you're going to come across problem that you need to solve. Learning algorithms translates to learning different techniques to efficiently solve those problems. One problem can be solved in many ways using different algorithms.

Algorithm Analysis:

We evaluate the performance of an algorithm in terms of its input size.

  1. Time Complexity: Amount of time taken by an algorithm to run, as a function of input size

  2. Space Complexity: Amount of memory taken by an algorithm to run, as a function of input size

By evaluating against the input size, the analysis is not only machine independent but the comparison is also more appropriate.

  • There is no one solution that works every single time. It is always good to know multiple ways to solve the problem & use the best solution, given your constraints.
  • If your app needs to be very quick & has plenty of memory to work with, you don't have to worry about space complexity.
  • If you have very little memory to work with, you should pick a solution that is relatively slower but need less space.

How to represent complexity?

Asymptotic notations : Mathematical tools to represent time & space complexity

  1. Big-O Notation: Worst case complexity (✅)
  2. Omega Notation: Best case complexity (❌)
  3. Theta Notation: Average case complexity (❌)

Big-O Notation Guide:

  1. Calculation not dependent on Input Size: O(1) - Constant
  2. One Loop: O(n) - Linear
  3. Two Nested Loops: O(n^2)
  4. Input Size reduced by Half: O(log n)

Complexity Chart


Algorithms:

  1. Math Algorithms

    • Fibonacci Sequence
    • Factorial of a Number
    • Prime Number
    • Power of Two
  2. Recursive

    • Fibonacci Sequence
    • Factorial of a Number
  3. Searching Algorithms

    • Liner Search
    • Binary Search
  4. Sorting Algorithms

    • Bubble Sort
    • Selection Sort
    • Insertion Sort
    • Merge Sort
    • Quick Sort
  5. Miscellaneous Algorithms & Problem Solving


Data Structure:

  1. Stack
  2. Queue
  3. Single Linked List
  4. Double Linked List
  5. Binary Search Tree
  6. Tree Traversal
  7. Binary Heaps
  8. Hash Tables
  9. Graph
  10. Graph Traversal

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published