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))
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.
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.
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
and tech recruiters too ;)
studying sjf in os and then implementing it, sure is fun!
God bless! striver for the hardwork
"UNDERSTOOD BHAIYA!!"
Understood ❤
Can we expect Stack and Queue playlist by end of this month or next month ?
YES! ...........................................................................................
Thank you 🙏
Thank you So much.
you are best ❤
In code I think calculation was wrong (order of writing statement)
Take love ❤❤❤
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.
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
Videos on string stack queue too please?
Understood
so we are assuming every process as a arrival time zero right
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))
loop should be till nth element
Well explained !
please bring the string video first .A humble request from us
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
ty sir
sir u are awesome
understood
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
correction : the loop should iterate from 0 to n - 2 and not n - 1
awesome
Maza aaya
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.
thanks
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.
understood
mujhe to ye question hi samajh nahi aya tha pehli bar me
I love u raj vikramaditya
🙏
4;30
US
First view❤
please bring the string video first .A humble request from us
Understood
Thanks
Understood
Understood