thank you sir.your explanation is best explanations in whole youtube.
@KomalSinghbooks6 жыл бұрын
The O(n) solution will pint the answer in reverse order which can lead to the Wrong answer, so a better way would be to store the answer in another array and print in reverse order :) BTW nice explanation!
@Hemanthreddy-i1l11 ай бұрын
good explanation sir, you would take (i=size-1) in for loop to get correct in different test cases ,if you take size-2 first array will miss for some testcases
@ArjunSingh-ef9oe Жыл бұрын
very nice explaination sir
@BECSAQUIB3 жыл бұрын
Great work! Keep it up
@bqrkhn6 жыл бұрын
The actual question is: Given an array, print all the leaders. Now if we scan from the right and keep current max element, we can easily print the elements. Check out geeksforgeeks.
@Ankit135557 жыл бұрын
why dont we return the max element in array and last element in array.....please tell me where test cases will fail
@vivekanandkhyade7 жыл бұрын
{ 1 , 25 , 50 , 40 , 30 , 20 , 21 , 28 } here 50 is max and 28 is last element. Both are Leaders. But 30 is also the leader beacause all elements on right side of 30 are less than 30.
@vivekanandkhyade7 жыл бұрын
Yes and 40 is also the leader.
@Ankit135557 жыл бұрын
Vivekanand Khyade - Algorithm Every Day means only move from right to left is only way..... thankyou for clearing the doubt
@khaledhariz63204 жыл бұрын
Sir, i think in the 2nd method that the condition is arr[i]>=mfr and the iteration start from n-1?
@prachiyadav16116 жыл бұрын
Is there any video on general tree ? (Trees)
@gurmeetchawla83626 жыл бұрын
hi vivekanand, if 16 is the rightmost element then what are your thoughts about this algo.
@santhuravikanti49886 жыл бұрын
i think if condition is not satisfied then mfr is the 16,please correct me if my understanding is wrong
@bhavadiph.gothadiya40265 жыл бұрын
but here one problem in this solution if print all leader number in order , then we have to maintain the order of leader because this solution return leader number in reverse order,,
@shivprachigupta71243 жыл бұрын
Can you provide full code for this😣
@shivprachigupta71243 жыл бұрын
Showing 0 leader...
@shivprachigupta71243 жыл бұрын
After i input values
@atishnarlawar11777 жыл бұрын
Are you not just finding the max element in the array ?
@pradipkumardas17385 жыл бұрын
always try to run the code after explanation
@suhailmir8327 жыл бұрын
if(j==n){ printf("Print the leader");// this needs to be outside the inner for loop }
@shivprachigupta71243 жыл бұрын
Show 0 leader... while run
@97388035355 жыл бұрын
In greeks for greeks for given below input they are looking for sequential output Example: Input array : 16 17 4 3 5 2 Output : 17 5 2
@ganeshnanekar37644 жыл бұрын
Just inverse an op... you'll get the write answer
@Hemanthreddy-i1l11 ай бұрын
for that u should take " for(i=size-1;i>=0;i--) " while doing logic
@FrozenByTheSun7 жыл бұрын
Thanks for the video. Your explanations are the best. Can you make one about external sorting? I can’t get it. I’ve sent you an email with the problem
@divyalakshmip9255 жыл бұрын
sir this method is not working for this input 7 4 7 5 3 it gives a o/p 7 3 but its actual o/p is 7 7 3
@anandjha53535 жыл бұрын
Its correct output should be 3, 5, 7 only
@letsexplorewith_jaggu984 жыл бұрын
@@anandjha5353 7 7 5 3 should be the answer sir
@anandjha53534 жыл бұрын
@@letsexplorewith_jaggu98 An element is leader if it is greater than all the elements to its right side. So the output should be 7 5 3 only. If we are counting 7 two times then second seven is equal not greater to all its right element so this should not be included.
@letsexplorewith_jaggu984 жыл бұрын
@@anandjha5353 it's okay sir.. I just said included with duplicates too.. I just remembered you that Divyalakshmi missed 5 in her answer.