Skip to content

Commit 1b3226b

Browse files
committed
chore: fix
1 parent 3948b1f commit 1b3226b

File tree

1 file changed

+76
-14
lines changed

1 file changed

+76
-14
lines changed

README.md

Lines changed: 76 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@
119119
- [BST](#bst)
120120
- [For Finding PREDECESSOR](#for-finding-predecessor)
121121
- [For Finding SUCCESSOR](#for-finding-successor)
122+
- [Constraints on Coding interview](#constraints-on-coding-interview)
123+
- [Most Important](#most-important)
124+
- [How to start DSA?](#how-to-start-dsa)
125+
- [Step 1: First learn language](#step-1-first-learn-language)
126+
- [Step 2: Learn Data Structure (DS)](#step-2-learn-data-structure-ds)
127+
- [Step 3: Learn Algorithms](#step-3-learn-algorithms)
128+
- [How much questions I should do?](#how-much-questions-i-should-do)
129+
- [How to solve questions?](#how-to-solve-questions)
122130
- [References](#references)
123131

124132
> Coding interview question answers in JavaScript for Facebook, Amazon, Google, Microsoft or any company.
@@ -689,16 +697,14 @@ node .\src\math-and-stats\integer-division.js
689697

690698
## JavaScript Fundamentals
691699

692-
693700
### Initialize 2D Array 4x4 with 0
694701

695702
```js
696-
const x = new Array(4).fill( new Array(4).fill(0))
703+
const x = new Array(4).fill(new Array(4).fill(0));
697704
```
698705

699706
![](https://i.imgur.com/JXVJGgJ.png)
700707

701-
702708
### JavaScript Map
703709

704710
```js
@@ -1249,9 +1255,9 @@ Below problems are lying under optimization problems. Just watch `Book Allocatio
12491255
It is useful for optimization problem.
12501256
Below is the template for Greedy Algorithm.
12511257

1252-
- Watch this [video from Love Babbar](https://www.youtube.com/watch?v=sq_cXYjSglQ&list=PL4PCksYQGLJOcaPLgeMFaxaHigPFjBuTG&index=5)
1258+
- Watch this [video from Love Babbar](https://www.youtube.com/watch?v=sq_cXYjSglQ&list=PL4PCksYQGLJOcaPLgeMFaxaHigPFjBuTG&index=5)
12531259
- Watch [these videos](https://www.youtube.com/watch?v=HzeK7g8cD0Y&list=PLqM7alHXFySESatj68JKWHRVhoJ1BxtLW&t=0s) to learn greedy algorithm
1254-
- Find the solutions of the problems shared by [Love Babbar here](https://www.youtube.com/watch?v=AsbDqOauGZE&list=PLDdcY4olLQk3cAxZPJXMbxqrM3PlNkmO8)
1260+
- Find the solutions of the problems shared by [Love Babbar here](https://www.youtube.com/watch?v=AsbDqOauGZE&list=PLDdcY4olLQk3cAxZPJXMbxqrM3PlNkmO8)
12551261

12561262
```js
12571263
getOptimal(items, n)
@@ -1280,7 +1286,7 @@ Note: Greedy Algorithms may not work always like Longest Path in Binary Tree.
12801286

12811287
Below are the standard problems solved by Greedy Algorithms. I have solved first 4 problems listed below:
12821288

1283-
https://codepen.io/collection/QWbzGB
1289+
https://codepen.io/collection/QWbzGB
12841290

12851291
- Activity Selection
12861292
- Fractional Knapsack
@@ -1294,26 +1300,82 @@ https://codepen.io/collection/QWbzGB
12941300
- Finding close to optimal solutions for `NP Hard Problem` like `Travelling Salesman Problem`
12951301

12961302
### Huffman Coding
1303+
12971304
Merge 2 smallest and make one node.
1298-
Next select 2 smallest and make one node.
1305+
Next select 2 smallest and make one node.
12991306
Repeat the merge process
13001307

13011308
Always select 2 minimum one is called as Greedy Algorithm.
13021309
This is called as Optimal Merge Pattern Tree which is Greedy approach
13031310

13041311
![](https://i.imgur.com/eg0KRQ5.png)
1305-
## BST
13061312

1307-
### For Finding PREDECESSOR
1308-
- Take a LEFT then go extreme RIGHT to get predecessor of given node
1309-
- While going right update predecessor
1313+
## BST
1314+
1315+
### For Finding PREDECESSOR
1316+
1317+
- Take a LEFT then go extreme RIGHT to get predecessor of given node
1318+
- While going right update predecessor
1319+
1320+
### For Finding SUCCESSOR
1321+
1322+
- Take a RIGHT then go extreme LEFT to get successor of given node
1323+
- While going left update successor
1324+
1325+
## Constraints on Coding interview
1326+
1327+
Read the given constraints before coding and applying algorithm.
1328+
1329+
If `N < 10^5` then you must solve the problem in run time complexity of `O(N)` or `O(N log (n))`
1330+
1331+
### Most Important
1332+
1333+
If constraints are given then read them and then decide complexity.
1334+
1335+
| N | RunTime Complexity |
1336+
| --------------- | ---------------------- |
1337+
| N < 4000 (10^3) | O(n^n) or O( n log(n)) |
1338+
| 10^5 | O(n) or O(n log (n)) |
1339+
| 10^9 | O(log(n)) or O(1) |
1340+
1341+
**Examples:**
1342+
1343+
https://www.codechef.com/problems/DECODEIT This should be done within `O(n) or O(n log (n))`
1344+
1345+
## How to start DSA?
1346+
1347+
### Step 1: First learn language
1348+
1349+
### Step 2: Learn Data Structure (DS)
1350+
1351+
While learning DS solve problems for the same DS also. Example if you are learning string then solve the problems for the string.
1352+
1353+
### Step 3: Learn Algorithms
1354+
1355+
- Number Theory
1356+
- Sorting Algorithms
1357+
- Merge
1358+
- Quick
1359+
- Searching
1360+
- Linear
1361+
- Binary
1362+
- Recursion & Backtracking
1363+
- Greedy
1364+
- Graph
1365+
1366+
### How much questions I should do?
1367+
1368+
Every topic finish `30 to 40` questions. For `Array`, `String`, `Recursion` and `Graph` do more than 50 questions.
13101369

1311-
### For Finding SUCCESSOR
1312-
- Take a RIGHT then go extreme LEFT to get successor of given node
1313-
- While going left update successor
1370+
### How to solve questions?
13141371

1372+
Go to practice page: https://practice.geeksforgeeks.org/explore/?page=1
13151373

1374+
**Every day do below:**
13161375

1376+
- 3 easy questions
1377+
- 2 medium questions
1378+
- 1 hard question
13171379

13181380
## References
13191381

0 commit comments

Comments
 (0)