There is a slight error in the code. The inner for loop should start from j = deadline (arr[I].dead) till j >= 1 not 0. Because otherwise we are adding arr[0] but there is no day 0 to do work
Thank you striver for the yet another wonderful explanation. If anyone can tell how we can reduce the time complexity of internal loop to O(1) using DSU , please explain the logic. Thank you
@@dumpster-jackson I have given the priority queue approach to further optimize the sorting solution from O(n*n) to O(n*logn) bro. Instead of using Dsu we can use priority queue to approach
I think it is to avoid like the deadline - 1 when changing value in hash, but the inner for loop should go from j = deadline to j >= 1 not till 0 because otherwise the output is not correct. I believe that is the error.
00:04 Solve job sequencing problem to maximize profit. 02:15 Maximize profit by scheduling jobs with deadlines efficiently 04:25 Maximize profit by scheduling jobs within deadlines. 06:21 Maximizing profit by scheduling jobs based on deadlines. 08:19 Job sequencing problem solved using Greedy Algorithm 10:09 Understanding the comparator logic and sorting based on profit in job sequencing problem 12:17 Iterating through jobs to maximize profit 14:17 Optimizing job sequencing problem complexity and space
There is a slight error in the code. The inner for loop should start from j = deadline (arr[I].dead) till j >= 1 not 0. Because otherwise we are adding arr[0] but there is no day 0 to do work
ok
Day 0 or Time 0 should not be considered... As per the prob in GFG !!!
String please 🙏
Thank you striver for the yet another wonderful explanation.
If anyone can tell how we can reduce the time complexity of internal loop to O(1) using DSU , please explain the logic. Thank you
Sir please start making videos on strings and stacks
Slightly mis typed Error in code It will be hash[ j ] = arr[i].jobid ... it will be hash of j not i
Bhaiya, Strings aur Stack and Queue ki playlist kab laoge
Hi Striver, we can even use priority queue to optimize, basically choose only the maximum profit job from the jobs with the same deadline.
That will add extra O(n) space -> priority queue. Hence sorting will be better
@@dumpster-jackson I have given the priority queue approach to further optimize the sorting solution from O(n*n) to O(n*logn) bro. Instead of using Dsu we can use priority queue to approach
@@anshulsharma3137 Good approach!!
Understood
tysm sir
One thing I cannot understand why array of size 7 is taken where as max deadline is 6!!??
for a job with deadline 6, you will put it into hash[6] right? so size of hash must be 7 for it to have 6 as valid index!
❤
What is the concept of day0? The day should start with 1 right?
same doubt
I think it is to avoid like the deadline - 1 when changing value in hash, but the inner for loop should go from j = deadline to j >= 1 not till 0 because otherwise the output is not correct. I believe that is the error.
@@priyadarsimishra7909 yeah u r correct
cout
00:04 Solve job sequencing problem to maximize profit.
02:15 Maximize profit by scheduling jobs with deadlines efficiently
04:25 Maximize profit by scheduling jobs within deadlines.
06:21 Maximizing profit by scheduling jobs based on deadlines.
08:19 Job sequencing problem solved using Greedy Algorithm
10:09 Understanding the comparator logic and sorting based on profit in job sequencing problem
12:17 Iterating through jobs to maximize profit
14:17 Optimizing job sequencing problem complexity and space
Hello baby 🤗
💀💀
really cant understand anything he says
You definetly will, Just don't quit for next 22 days!!