Skip to content

Commit 29560ab

Browse files
committed
chore: reorganize
1 parent 02a6631 commit 29560ab

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
- [Queue](#queue)
2727
- [Enqueue an element in Queue](#enqueue-an-element-in-queue)
2828
- [Dequeue an element from Queue](#dequeue-an-element-from-queue)
29-
- [Tree](#tree)
30-
- [Binary Tree](#binary-tree)
31-
- [Binary Search Tree (BST)](#binary-search-tree-bst)
29+
- [Tree](#tree)
30+
- [Binary Tree](#binary-tree)
31+
- [Binary Search Tree (BST)](#binary-search-tree-bst)
3232
- [Trie](#trie)
3333
- [Heap ( Priority Queue )](#heap--priority-queue-)
3434
- [Hash-Table](#hash-table)
@@ -42,6 +42,7 @@
4242
- [Merge Sort Implementation](#merge-sort-implementation)
4343
- [Find Median Values (With Merge Sort Algorithm)](#find-median-values-with-merge-sort-algorithm)
4444
- [Quick Sort](#quick-sort)
45+
- [Quick Sort Implementation](#quick-sort-implementation)
4546
- [BFS (Breath First Search)](#bfs-breath-first-search)
4647
- [Math & Stats](#math--stats)
4748
- [Integer Division Without Using \* or /](#integer-division-without-using--or-)
@@ -254,7 +255,7 @@ queue.shift(); // 3 , queue [4]
254255
queue.shift(); // 4 , queue []
255256
```
256257

257-
### Tree
258+
## Tree
258259

259260
A tree has hierarchical data and it has nodes.
260261

@@ -279,20 +280,22 @@ If you want to store hierarchical data use Tree.
279280

280281
You should know about `Binary Tree` and `Binary Search Tree`.
281282

282-
#### Binary Tree
283+
### Binary Tree
283284

284285
A binary tree is a type of tree in which each node has `at most two children` (0, 1 or 2) which are referred as left child and right child.
285286

286287
![](https://i.imgur.com/fkRP5Ju.png)
287288

288-
#### Binary Search Tree (BST)
289+
### Binary Search Tree (BST)
289290

290291
In Binary Search Tree nodes are:
291292

292293
- The key in the left subtree is less than the key in its parent node.
293294
- The key in the right subtree is greater or equal the key in its parent node.
294295

295-
![](https://i.imgur.com/Dk04fw4.png)
296+
![](https://i.imgur.com/u5WpbHe.png)
297+
298+
BSTs get an average case of `O(log n)` on gets, adds, and deletes, but they can have a worst case of `O(n)` if you do something like add a sorted list to a BST. Go ahead, do a BST then add [1,2,3,4,5] to it.
296299

297300
### Trie
298301

@@ -384,8 +387,12 @@ So in order to find median we can use the stich algorithm since arrays are alrea
384387

385388
### Quick Sort
386389

390+
When Browser's are not using Merge sort they most of the time use Quick sort variations.
391+
387392
![](https://i.imgur.com/LudZhvH.png)
388393

394+
#### Quick Sort Implementation
395+
389396
- [Implement Quick Sort Exercise](https://codepen.io/roopkt/pen/NWpzMRv?editors=0010)
390397
- [Implement Quick Sort Answer](https://codepen.io/roopkt/pen/eYvKrvP?editors=0010)
391398

0 commit comments

Comments
 (0)