Striver, your DSA Sheet is absolutely phenomenal! It's been an invaluable resource for mastering data structures and algorithms. Looking forward to the remaining topics, especially the much-anticipated sections on strings and heaps. Thanks for all your hard work!
ig without shorting you can't impliment sjf because the requirement is smallest will be executed first and for the sake of chossing smallest sorting is necessary. correct me if i am wrong
We are calculating waiting time for other processes. If we don't sort, even the process with smaller execution time will have to wait longer which will violate the SJF scheduling algo
Here is my solution: class Solution: def solve(self, bt): bt.sort() n = len(bt) wait_time= 0 total_wait_time = 0 for p in bt[0 : n - 1]: wait_time = (wait_time + p) total_wait_time += wait_time return total_wait_time // (len(bt))
Given is burst time. You need to take average of wait time. And shortest burst time need to be executed first, hence sorting required else you might take bigger burst time first.
u have to maintain a queue for that(if smaller burst time process arrives) and have to keep switiching between the process if any process you find in queue have less burst time , then you have to execute that process first.
Striver, your DSA Sheet is absolutely phenomenal! It's been an invaluable resource for mastering data structures and algorithms. Looking forward to the remaining topics, especially the much-anticipated sections on strings and heaps. Thanks for all your hard work!
Commenting first : “Not only students but the experienced employees also go through the playlist.”
thanks for the information bruh
studying sjf in os and then implementing it, sure is fun!
God bless! striver for the hardwork
Can we expect Stack and Queue playlist by end of this month or next month ?
YES! ...........................................................................................
"UNDERSTOOD BHAIYA!!"
Understood ❤
Thank you 🙏
Thank you So much.
Hey , no need to sort,
just do sum of array minus maximum element ÷ No of elements, which is more optimal
this will not work i think, if there are multiple jobs with same timeframe
Why do we need to sort here? Doesn't simply adding all the elements and dividing them by the size of the array give the same result?
ig without shorting you can't impliment sjf because the requirement is smallest will be executed first and for the sake of chossing smallest sorting is necessary. correct me if i am wrong
We are calculating waiting time for other processes. If we don't sort, even the process with smaller execution time will have to wait longer which will violate the SJF scheduling algo
that will make it FCFS and not SJF
see anyway we are skipping one element, by sorting we will skip the longest processing time, so thats soln
In code I think calculation was wrong (order of writing statement)
loop should be till nth element
youre lecture are amazing keep it up and bro plz a to z sda sheet wali list hatana mat i request you bcoz it help us alot.
Here is my solution:
class Solution:
def solve(self, bt):
bt.sort()
n = len(bt)
wait_time= 0
total_wait_time = 0
for p in bt[0 : n - 1]:
wait_time = (wait_time + p)
total_wait_time += wait_time
return total_wait_time // (len(bt))
you are best ❤
Videos on string stack queue too please?
Take love ❤❤❤
The tc is O(nlogn) or we have to write state O(n) + O(nlogn) ?
O(nlogn) > O(n) so we can simply write O(nlogn) time complexity
so we are assuming every process as a arrival time zero right
correction : the loop should iterate from 0 to n - 2 and not n - 1
Well explained !
sir u are awesome
understood
mujhe to ye question hi samajh nahi aya tha pehli bar me
why do we need to sort the arrary rather sum of all elements present in the array and then take the average if(average is only asked)
Given is burst time. You need to take average of wait time. And shortest burst time need to be executed first, hence sorting required else you might take bigger burst time first.
please bring the string video first .A humble request from us
ty sir
Understood
awesome
Maza aaya
thanks
How can we solve this question if the process is preemptive SJF. Can anyone give the solution for that.
u have to maintain a queue for that(if smaller burst time process arrives) and have to keep switiching between the process if any process you find in queue have less burst time , then you have to execute that process first.
understood
I love u raj vikramaditya
First view❤
🙏
US
4;30
please bring the string video first .A humble request from us
Understood
Thanks
Understood
Understood