The mirroring portion outside was an extremely nice touch.
@randomdude-kr4in4 жыл бұрын
What a day to be alive. Can't wait to watch!
@rohangarg54734 жыл бұрын
Thank you David for all the effort you put in making solution videos, screencast and lectures. Just a small suggestion or I should say Request, Kindly do lectures on not so advanced stuff with questions. Just like what you did for tree algorithms(problems on gym + explanation later), that was really helpfull. It would be really great if you could do for other topics as well(not so advanced topics) which can be helpfull and at the same time, frequently used in cf contests. Topics like:- Dp with bitmask Dp on segments Some dp problems which can be solved with recur + memo Graphs Tree dp Array problems increasing decreasing subsequence types. Etc Some gym questions + explanation later would be Great, just the way you did for tree algorithms. Thank you so much
@maximilianoredigonda86454 жыл бұрын
Had this resource be available in my good ol' ICPC times 🔥 hahaha nice job!
@askdf3 жыл бұрын
Great video SecondThread! Really looking forward to using treaps in my upcoming contests! :^)
@LeoLeo-nx5gi4 жыл бұрын
Ohh Holy, I was wandering everywhere to understand this topic since months, pls do take some problems and pls let us walk through the code step by step ❤️
@igorlukyanov7434 Жыл бұрын
Your videos are both funny and interesting. I absolutely love them!
@joacarrilloco4 жыл бұрын
Looking for a good treap tuto long ago. Nice video and gonna check out the problems! Thanks
@rivaille88674 жыл бұрын
Thanks for this great tutorial and codeforces problem set , appreciate what you are doing
@imranfarid81864 жыл бұрын
Tbh, I was kind of scared when you brought that axe!:)
@1732ashish4 жыл бұрын
I have been waiting to learn one of the balanced search trees and treap seems like a good starting point, I will be thankful if you can mention that case you talked about where you might explicitly need splay trees ?
@jonathanharmeyer22554 жыл бұрын
"Host" David Harmeyer. Woooaahhhh, hold up
@BleedingKnight4 жыл бұрын
Great tutorial David. I had two questions though. 1) Since treaps are randomized, what would be some safe constraints in contest problems for which treaps won't reach a height much worse than log(N) and timeout due to that? 2) Since the left to right order is preserved, I guess the relative order of any split up treaps of a larger treap cannot be changed while merging as it won't remain a BST. So I was wondering is there any efficient way to shuffle the order of the elements in a segment (like cyclically shift the segment right by 1) and do range queries on the modified order of elements? EDIT: Nvm about 2. To cyclically shift l...r to one right, we can just mirror l..r and then mirror l+1...r
@SecondThread4 жыл бұрын
You don't need to maintain the BST property either. The left to right order is only based on how you merge things, the example in the beginning was just to explain why it was randomized. As for constraints, you're probably safe up to about 2*10^5 but you might need a big time limit depending on how costly your internal operations are.
@BleedingKnight4 жыл бұрын
@@SecondThread Oh okay. But now if we don't maintain the relative order, isn't it possible that the height of the tree changes from logn to something much worse over a lot of queries? For example, if we have n updates where we split treap T at first n - 1 positions getting T1 and T2 as the new treaps and then merge in the order T2 and T1 to form T again, wouldn't this become much worse than logn height eventually? EDIT: Solved the gym contest's A problem. I guess it doesn't.
@mehulgoel58754 жыл бұрын
wow, I'm amazed at your intelligence, the speed you have in solving codeforces problems is wow too, it doesn't even seem you need to think hard about them at all
@martonnemeth2363 жыл бұрын
Nice explanation! :)
@weirongwu49644 жыл бұрын
Awesome video! Thanks David! What laptop do you use? Is this the surface pro? Love how you can draw ideas and diagrams out to help you visualize difficult concepts.
@SecondThread4 жыл бұрын
I actually use a desktop and have a cheap drawing tablet on from Amazon. It doesn't have a screen or anything, so I'm looking at my monitor, but my hand is just on my desk
@weirongwu49644 жыл бұрын
@@SecondThread Interesting. Thanks David!
@nuni_boyka78694 жыл бұрын
Loved the video awesome!
@tanishqgupta10714 жыл бұрын
He haven't uploaded yet 😂
@nuni_boyka78694 жыл бұрын
@@tanishqgupta1071 doesn't matter my comment would have been same.
@erray75464 жыл бұрын
@@nuni_boyka7869 SecondThread orz
@dontony70714 жыл бұрын
Sir please attend the Div 2 round🥺.Missing your post contest explanations now a lot.
@YASH_KHICHARIYA3 ай бұрын
8:43 Why will it get splitted into 1/3 and 2/3 on average?
@ДимаАртюхов-э6щ4 жыл бұрын
Hey, what's up! Are planning to do solutions for last Techno Cup round 2021? If so, I can't wait to see that)
@nallasivakrishna56934 жыл бұрын
The video is awesome.Clearly understood the concept. @second thread could you please provide solutions for codeforces 678 div2 round. It would be really helpful.Thanks in advance.
@jitendrapandey1764 жыл бұрын
Come on David ..come on 🔥🔥
@mikerega77244 жыл бұрын
You're the best I hope and one day compete with you why I know what will happen Nothing is impossible
@fuadalhasan17844 жыл бұрын
Hey good morning.. 😊
@dhairyapurohit80654 жыл бұрын
Hey brother if possible please make video on codeforces round 679(tecnicup once) specifically problem C div2 Perform Easily Kind of hard to understand from Tutorial part✌️ thank you
@shzaizzhang44654 жыл бұрын
Thanks.
@thallium544 жыл бұрын
In C++, using a vector to store the nodes is faster than pointers.
@thallium544 жыл бұрын
My implementation: github.com/thallium/acm-algorithm-template/blob/master/code/DataStructure/Treap_split.cpp
@SecondThread4 жыл бұрын
That's pretty clean. I like the pass-by-reference so you don't forget to update your treap root
@xinyuan1274 жыл бұрын
Wow, thank you :3
@shubhampokhriyal84914 жыл бұрын
Goood morning everybody 😻😻although night is going on
@satishshingade85144 жыл бұрын
very nice
@RifatulIslam__4 жыл бұрын
C++ code was helpful
@hadva24 жыл бұрын
Just a general guestion about Java: why do you, while doing competitive programming, put all methods to static? Wouldn't be simpler to just run an instance of the class in the main method and then not need to set everything to static (or is the execution faster with everything on static?).
@SecondThread4 жыл бұрын
Yeah, it might be shorter to code. Conceptually I like to save objects for when they are actually in an object of something though; it just makes more sense to me.
@nicktohzyu2 жыл бұрын
can treap do stabbing queries like segment tree? which is the problem that requires splay and not treap? why have the two children as `vector` rather than `Treap *left, *right` ?
@SecondThread2 жыл бұрын
1) What's a stabbing query? You can do a range query of width 1 if that's what you mean 2) Nothing with a splay tree is *impossible* with a treap, but some things are a log factor slower. An example of this is implementing a Link Cut Tree. That's like the main and only one I know of. 3) So that you can flip left and right really easily. If you access your kids as kids[0^flip], this will always access the *left* kid even when you need to propogate a flip still.
@mikaoj3174 жыл бұрын
is it possible to get ur scanner class?
@puedoamarte4 жыл бұрын
Do more algorithms please
@satishshingade85144 жыл бұрын
good everybody
@namitaa2 жыл бұрын
sir u are fine
@tsyetsye76894 жыл бұрын
Please be my sensei David....orz....!!!!!
@ritwizsinha12614 жыл бұрын
YAYYAYYAYA
@akashchandra22234 жыл бұрын
how did you get so smart, are you naturally inclined
@mehulgoel58754 жыл бұрын
I think he is. Even I find him mind boggling quick in seeing through the problem to the solution. And watching him in action inspires me to atleast try to emulate it. Feels similar to how I felt after watching the movie and tv series "Limitless".
@karanb20674 жыл бұрын
I thought the video said "meap"...whatever tho, good usage of time!
@ishanpatni26844 жыл бұрын
Please share your java template
@tabletalenovo96953 жыл бұрын
Bruh how tf do u do that palindrome problem
@iprakhar224 жыл бұрын
"Finding daddy" hmm ok
@MohitYadav-yv2rw4 жыл бұрын
Yummy!!!
@sathvikkuthuru78044 жыл бұрын
orz
@madhukiranattivilli23212 жыл бұрын
I'm sorry! Ur MERGE explanation wasn't understandable at all! U shud've used names to the nodes, or some other style to narrate. U were talking about priorities but u didn't assign any priorities to the nodes while explaining the concept (as an illustration). I hope I'll understand better while watching ur code section.