Skip to content

Commit 556e117

Browse files
author
Prakharnagore000
committed
Performance of Arrays and Objects
1 parent 8a9210d commit 556e117

File tree

2 files changed

+47
-0
lines changed

2 files changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// BUILT-IN DATA STRUCTURES
2+
// Through the lens of Big O
3+
4+
// Objects
5+
// Unordered key value pairs
6+
// When to use objects
7+
// When you don't need order
8+
// When you need fast access / insertion and removal
9+
10+
// Big O of Objects
11+
// Insertion - O(1)
12+
// Removal - O(1)
13+
// Searching - O(N)
14+
// Access - O(1)
15+
16+
// Big O of Object Methods
17+
// Object.keys - O(N)
18+
// Object.values - O(N)
19+
// Object.entries - O(N)
20+
// hasOwnProperty - O(1)
21+
22+
// Arrays
23+
// Ordered lists!
24+
// WHEN TO USE ARRAYS
25+
// When you need order
26+
// When you need fast access / insertion and removal (sort of....)
27+
28+
// Big O of Arrays
29+
// Insertion - It depends....
30+
// Removal - It depends....
31+
// Searching - O(N)
32+
// Access - O(1)
33+
34+
// Big O of Array Operations
35+
// push - O(1)
36+
// pop - O(1)
37+
// shift - O(N)
38+
// unshift - O(N)
39+
// concat - O(N)
40+
// slice - O(N)
41+
// splice - O(N)
42+
// sort - O(N * log N)
43+
// forEach/map/filter/reduce/etc. - O(N)
44+
45+
// Limitations of Arrays
46+
// Inserting at the beginning is not as easy as we might think!
47+
// There are more efficient data structures for that!

README.md

76 Bytes

Data-Structure-And-Algorithm-Notes

Syllabus

Big O Notation

  1. Big O Notation
  2. Performance of Arrays and Objects

0 commit comments

Comments
 (0)