Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/abdullahsadik00/dsa
https://github.com/abdullahsadik00/dsa
Last synced: 20 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/abdullahsadik00/dsa
- Owner: abdullahsadik00
- Created: 2023-07-02T18:30:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-07-17T20:04:24.000Z (over 1 year ago)
- Last Synced: 2024-11-08T08:45:01.340Z (2 months ago)
- Language: JavaScript
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Day 1
# Big O notation
### O(1)
Constant- no loops
### O(log N)
Logarithmic- usually searching algorithms have log n if they are sorted (Binary Search)
### O(n)
Linear- for loops, while loops through n items
### O(n log(n))
Log Liniear- usually sorting operations
### O(n^2)
Quadratic- every element in a collection needs to be compared to ever other element. Two
nested loops
### O(2^n)
Exponential- recursive algorithms that solves a problem of size N
### O(n!)
Factorial- you are adding a loop for every element
### Iterating through half a collection is still O(n)
### Two separate collections: O(a * b)# What can cause time in a function?
Operations (+, -, *, /)
Comparisons (<, >, ==)
Looping (for, while)
Outside Function call (function())
## Rule Book
### Rule 1:
Always worst Case
### Rule 2:
Remove Constants
### Rule 3:
Different inputs should have different variables. O(a+b). A and B arrays nested would be
O(a*b)
+ for steps in order
* for nested steps
### Rule 4:
Drop Non-dominant terms## What causes Space complexity?
* Variables
* Data Structures
* Function Call
* Allocations