Coding Interview Question | Majority Element in array | Data Structures and Algorithms

preview_player
Показать описание

This is a very detailed explanation. If you want to watch only subparts, here is your guide for the video-
0:00-1:05-Question explanation
1:05-4:10-Various solutions and complexities
4:10-5:40-Observations and first assumption
5:40-10:50-Solution using 2 counters and assumption of knowing max element
10:50-15:26-1 Counter approach with assumption
15:26-23:00-Solution without any assumptions
23:00-24:30-Why we need second traversal
24:30-26:50-Step by step algorithm
26:50-30:53-Examples using final algorithm

Рекомендации по теме
Комментарии
Автор

Though this is not my subject, I can see the confidence and clarity. Keep it up.

akasnani
Автор

Very intelligently choosen sample cases..Clears all cases. Thanks Keerti.

atulpandey
Автор

Love your great and honest effort in explaining the solution step by step !!

sharatpaul
Автор

thanks for giving this much detailed explanation and dryrun the code at every new assumption, will help a lot to improve our thinking approach to any problem
thanks!!

vikaspanwar
Автор

hey hi your dynamic proramming lectures are very nice please continue i am learning i likeyour videos very much please explain more algorithms

saiadityaede
Автор

Hi Keerti, Honestly I really appreciate your efforts. Very well explained. Thanks for investing your time to explain this problem. It would definitely help a lot like me. Looking forward for more such content.

syedpeerasaheb
Автор

Great initiative ma'am, , keep posting such videos, , watching this video from a rural area and learning this competitive programs is so blissful.. Thank you ma'am.... I am a 3 rd year student in a private college from Bihar

subhashgupta
Автор

Hi keerti, came here after watching you at Clemente's channel..I must say you gave the best explanation and clarity on this problem. Thank you..please keep posting more good problem solutions explanation..

smilealways
Автор

Di....bhott clear smjh ata h....Thank God!I got this channel of keerti Purswami😊

soniamalik
Автор

@Keerti, nice explanation. One question, at 23:50 you mentioned candidate represent element that appear max times in array. Is it correct in all cases? eg. {5, 5, 2, 3, 2, 5, 4} i=6, counter=1, candidate=4, but element that appear max times in array is 5 (appears 3 times)

sojanmathew
Автор

Nice explanation. Should be used to cure corona.

geeksentertainmentmedia
Автор

Is there a way to make the second algorithm work for an element which appears N/K times not just when K is 2 or 3?

samridhsinha
Автор

Can we use hashing here, storing key and it's count....just curious about it as time complexity will be same

cheems
Автор

DI JUST 1 DOUBT.... IF IN THE QUESTION IT IS STATED THAT U MAY ASSUME THAT THERE'S ALWAYS 1 MAJORITY ELEMENT .... THEN CAN WE SKIP THE STEP 2 OF TRAVERSING THE ARRAY AGAIN ? OR SHOULD WE STILL DO THAT ??

BTW ITS REALLY APPRECIABLE DI...UR QUALITY TEACHING & EXPLANATION IS THE BEST... JUST YEH 1 DOUBT THA..
TIA💖

VaishnaviNigam
Автор

Try to make it concise..It's really difficult to concentrate for 30 mins when you have just 4-5 steps in Moore's voting algo..this length is acceptable for difficult questions like two player stone game or sudoku solver ..

swagatpatra
Автор

Please improve the audio quality! Very nice explanation though.

jaggis
welcome to shbcf.ru