Randomized algorithms lecture #1 - probability, repeating a process

This is a lecture on randomized algorithms in Competitive Programming. Second part: • Randomized algorithms ...
Codeforces blog with mentioned problems: codeforces.com/blog/entry/71097
About C++ rand() function in Codeforces: codeforces.com/blog/entry/61587
Expected value blog: codeforces.com/blog/entry/62690
More randomized problems: codeforces.com/blog/entry/51244
Subscribe for more educational videos on algorithms, coding interviews and competitive programming.
- Frequently Asked Questions: github.com/Errichto/youtube/w...
- Github repository: github.com/Errichto/youtube
- KZread channel 1: / errichto (lectures and single problems)
- KZread channel 2: / errichto2 (streams)
- Competitive Programming Discord: discordapp.com/invite/UzaURu7

Пікірлер: 55

  • @Errichto
    @Errichto4 жыл бұрын

    In the ACTG problem, I focused on the number of queries and forgot about the running time. Let's say the time limit is huge, like 50 seconds :D And the constraint for a[i] in GCD problem is actually 10^12, not 10^5.

  • @sajalagrawal1430

    @sajalagrawal1430

    4 жыл бұрын

    Thanks

  • @shivamnegi7848

    @shivamnegi7848

    4 жыл бұрын

    Informative video Looking forward for more of this kind of stuff.

  • @Rahulpal-xq2hu

    @Rahulpal-xq2hu

    4 жыл бұрын

    When will you post next video on dynamic programming..eagerly waiting for that..

  • @masternobody1896

    @masternobody1896

    4 жыл бұрын

    Can you show me how to make a game in python or anything

  • @yoda6994

    @yoda6994

    4 жыл бұрын

    It will be great if you can cover problems related to probability/expected values in your future videos. Thanks for such great explanation.

  • @normantuan56
    @normantuan564 жыл бұрын

    i absolutely adore randomized algorithm! Thanks Errichto!

  • @hidayatkhan412
    @hidayatkhan4124 жыл бұрын

    I always wanted a tutorial on randomized algorithms. Thank You

  • @undisputed__9166
    @undisputed__91664 жыл бұрын

    Thank you so much for your videos. Please keep making videos. You are helping out a lot of people. Cheers !!

  • @hutofrock
    @hutofrock4 жыл бұрын

    Thank you, Kamil! I liked the video a lot and I'm looking forward the next part of the lecture! :)

  • @shivangraina9698
    @shivangraina96984 жыл бұрын

    thanks very much Errichto.Hope you reach out to a larger audience.

  • @getintodevices1215
    @getintodevices12154 жыл бұрын

    Thank you Errichto!

  • @AshishKumar-jj7yw
    @AshishKumar-jj7yw4 жыл бұрын

    Quality stuff. Thank you very much.

  • @hellooomelloo5406
    @hellooomelloo54064 жыл бұрын

    Very interesting lecture Keep it up!

  • @aditya_01
    @aditya_01 Жыл бұрын

    as always a great video please make more such edu videos. Thank you for your time and effort.

  • @jay-rathod-01
    @jay-rathod-014 жыл бұрын

    Hey amazing video scholar!!

  • @user-jm1jf4et1e
    @user-jm1jf4et1e Жыл бұрын

    fantastic !

  • @liquidmetal718
    @liquidmetal7184 жыл бұрын

    Hi, is there a catalog of good problems to learn & solve , any reference ?

  • @fbru02
    @fbru024 жыл бұрын

    I took a whole grad course on randomized algorithms and all I learned was chebyshev, this is much better!

  • @asma-pe3rx
    @asma-pe3rx4 жыл бұрын

    Recently bumped into a question which says to write a function which generates random numbers within a given range, provided I can't use any pre-defined function or any functions defined within any third party packages.Any suggestion on how to do it..?

  • @samatbryan
    @samatbryan4 жыл бұрын

    For Line through N/4 problem, do we check for each ~200 pair of points the number of points on the same line? So O(200n) = O(n) and take the line with maximum number of points?

  • @Errichto

    @Errichto

    4 жыл бұрын

    Yes, exactly that.

  • @thallium54
    @thallium544 жыл бұрын

    Can you talk about the Simulated annealing next time?

  • @mohamedfouad6492
    @mohamedfouad64924 жыл бұрын

    19:45 seemed like you are talking about reverse engineering a trading algorithm

  • @zenenhornstein2429
    @zenenhornstein24294 жыл бұрын

    6:33 Can you explain how you found the complexity so fast? i don't understand where n^2 pair come from

  • @admar3387

    @admar3387

    4 жыл бұрын

    Zenen Hornstein the algorithm goes through every point and checks with every other point so n^2

  • @thatoneguy908
    @thatoneguy9084 жыл бұрын

    at 14:49 after the observation of skipping last character ,isn't it should be (1 + 2 + 3 )/3 instead of (1 + 2 + 3 + 3)/4 as we have skipped last char and maximum query we gonna ask is 3 ? please reply...

  • @so7am96

    @so7am96

    4 жыл бұрын

    I have the same question

  • @Errichto

    @Errichto

    4 жыл бұрын

    That's a good question. It isn't correct to say that there are three equally likely possibilities. There are four. It's just that two of them give the same result (number of queries). Imagine that you take a 6-sided die and change one number from 6 to 5. The expected value of pipes you get is now (1+2+3+4+5+5)/6. There are still six possibilities, you just change one of their outcomes. Let's say you go with order CATG. There are four possibilities which character is hidden: A, C, T, G. You need 2, 1, 3, 3 queries, respectively.

  • @Player-ub9tg
    @Player-ub9tg4 жыл бұрын

    For problem ACTG , we can find answer in 2*N+2 queries without random.

  • @Errichto

    @Errichto

    4 жыл бұрын

    I don't see how to do it deterministically. Can you elaborate? 3*N is easy (just ask about A, C, T) but how to improve it?

  • @ece03abhisheksrivastava64
    @ece03abhisheksrivastava643 жыл бұрын

    Sir but every time coin is tossed probability is 1/2 , does not depends on previous toss , so repeating is not sure

  • @shashwat_hai9164
    @shashwat_hai91644 жыл бұрын

    Just wanted a suggestion from you: Would you change your entire approach towards a question if you don't get the correct solution (even when you know there is a slight change required) or try to find that small mistake when in a competition?

  • @shashwat_hai9164

    @shashwat_hai9164

    4 жыл бұрын

    What would you prefer a new start or making minor changes in your current approach?

  • @Errichto

    @Errichto

    4 жыл бұрын

    I will first try to find a mistake. If I can't do it for a long time and the code is short, then I would rewrite it.

  • @kp2718
    @kp27184 жыл бұрын

    Hi, I'm so glad to see you do what you're doing and I want you do very well so excuse me for this unsolicited advice: Maybe it would help you to go to a voice coach, or an average logopeda ;) ? I know it helped me a lot and it would give you a boost not just on youtube, it gave my Charisma +3. It's unbelievable how ppl want to listen to you and hang around you more if you hv a great command of your voice.

  • @Errichto

    @Errichto

    4 жыл бұрын

    Yes, I do plan that. The issue is lack of time :( similar thing with gym: I want to go there often but I'm lazy plus there are so many other things to do.

  • @partharora16
    @partharora164 жыл бұрын

    In problem 3 ( Given n points , find a line that passes through max possible of them ) , can we say if we select a pair of points , they have probability atleast 1/16 that these pair of points will be in line that passes through maximum points . Now if we select another different pair of points , it will also have probability 1/16 for the same event . So , if we repeat the process 16 times , then probability will be 16*(1/16) , that at least one of these 16 pairs will be included in the line that passes through maximum points . This don't really seem right to me , can somebody please explain where i am going wrong ?

  • @amarnathprasad9986

    @amarnathprasad9986

    3 жыл бұрын

    Hey, it's been a year. I hope you've understood by now, but I'll leave an explanation should anyone else face the same doubt in the future. You have to multiply the probabilities (1/16) and (1/16) and not add them. That's why, if you repeat the selection 16 times, the probability will be (1/16)^16 and not 16*(1/16). That's because they are independent and separate events.

  • @vickyjha5535
    @vickyjha55353 жыл бұрын

    In the problem selection of 1st point probability is 4/16 = 1/4 while selection of other point will be 15/16. So (1/4)*(15/16) will be equal to ~1/21. And not 1/16

  • @ahmedelbarqy4849
    @ahmedelbarqy4849 Жыл бұрын

    in some sense it's very similar to the pigeon hole principal

  • @tuanva6484
    @tuanva64844 жыл бұрын

    can you make a tutorial video from scratch

  • @Errichto

    @Errichto

    4 жыл бұрын

    This was a tutorial video from scratch :|

  • @shrad6611
    @shrad66114 жыл бұрын

    can you please add donation button to your stream so we can help you to get more content like this. I hope many viewers want to help you

  • @gosunov
    @gosunov2 жыл бұрын

    In YES/NO problems, you can use randomized algorithm! With 50% chance print YES in other cases print NO.

  • @aryelpanda
    @aryelpanda2 жыл бұрын

    toss a coin to your witcher

  • @user-bq2fc5cf4w
    @user-bq2fc5cf4w3 жыл бұрын

    I am engineer. I cant wait to show those methods to my pure mathematic friend! I hope not kill his self :D