Skip to content

Commit 0e621d8

Browse files
committed
chore: updated
1 parent 6e5a308 commit 0e621d8

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

‎README.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -1211,32 +1211,40 @@ Binary Search is used to solve 2 kinds of problems:
12111211
- Watch this [Binary Search conceptual video from Errichto](https://www.youtube.com/watch?v=GU7DpgHINWQ&list=PLl0KD3g-oDOHpWRyyGBUJ9jmul0lUOD80)
12121212

12131213
Next you have to solve some basic binary search problems.
1214+
12141215
### Binary Search Basic Problems
12151216

12161217
- Do all basics problems related to binary search [that I have given in this link](https://codepen.io/collection/vBORpO)
12171218
- Next do all below advanced problems
12181219

12191220
### Binary Search Advanced Questions
12201221

1221-
Below problems are lying under optimization problems. Just watch `Book Allocation` and `Aggressive Cows` videos (links are below) to understand optimization logic. Once you understood them after that for rest problems you need to apply same logic. Every iteration you reduce the search space by either maximizing or minimizing the solution.
1222+
Below problems are lying under optimization problems. Just watch `Book Allocation` and `Aggressive Cows` videos (links are below) to understand optimization logic. Once you understood them after that for rest problems you need to apply same logic. Every iteration you reduce the search space by either maximizing or minimizing the solution.
12221223

1223-
- [Book Allocation](https://www.youtube.com/watch?v=Ss9ta1zmiZo&t=1335s)
1224+
- [Book Allocation](https://www.youtube.com/watch?v=Ss9ta1zmiZo&t=1335s)
12241225
- [Aggressive Cows](https://www.youtube.com/watch?v=TC6snf6KPdE)
12251226
- [Painter's Partition](https://www.geeksforgeeks.org/painters-partition-problem/)
12261227
- [EKO (SPOJ)](https://www.spoj.com/problems/EKO/)
12271228
- [PARATA - Roti (SPOJ)](https://www.spoj.com/problems/PRATA/)
12281229

1230+
## Greedy Algorithm
12291231

1232+
It is useful for optimization problem.
1233+
Below is the template.
12301234

1231-
## Greedy Algorithm
1232-
1233-
It is useful for optimization problem.
1235+
```js
1236+
getOptimal(items, n)
1237+
1- Initialize result as 0
1238+
2- while(all items are not considered) {
1239+
i = selectAnItem()
1240+
if(feasible(i))
1241+
result = result +1;
1242+
}
1243+
3- return result;
1244+
```
12341245

12351246
- Watch [these videos](https://www.youtube.com/watch?v=HzeK7g8cD0Y&list=PLqM7alHXFySESatj68JKWHRVhoJ1BxtLW&t=0s) to learn greedy algorithm
12361247

1237-
1238-
1239-
12401248
## References
12411249

12421250
- http://btholt.github.io/four-semesters-of-cs/

0 commit comments

Comments
 (0)