This is legendary content, so glad I found this gem that unearths low level concepts from high level ones, especially in Python
@DanielBoctor
8 ай бұрын
You really just binged half my channel LOL you are the real legend here. I appreciate the support, it means a lot ❤️. I'm glad they're helpful
@sanderbos4243
11 ай бұрын
I love deques/circular buffers, they are immensely useful (apart from the name; my friend refuses to call it deck and pronounces it dequeue, which is understandable, but that name also means popping from a queue) In my experience however the order of elements in a list/array often doesn't matter, and so you can just use the "swap-remove" `lst[i] = lst.pop()` to remove any element you want in O(1), which is especially useful in C, where you'd have to write a small deque library otherwise :)
@DanielBoctor
11 ай бұрын
I also used to call them dequeues when I first learnt about them LOL. That's an incredible tip btw, I never thought of that myself! Quite elegant. Thanks for sharing
@sanderbos4243
11 ай бұрын
@@DanielBoctor In C it's surprisingly also a single line, btw! `arr[i] = arr[--len];`
@DanielBoctor
11 ай бұрын
What a beautiful line of code
@mangopolice
5 ай бұрын
I love how you teach so much in just 3 minutes
@__Merchant
2 ай бұрын
While deques are faster, they declare slower. (for example: my_deque = deque(100_000_000) takes at least 2 seconds for me) I was confused why it was slower for me until I started timing it in all sorts of ways using your examples. They are faster in everything else but are slower at declaring. this however does not matter much in smaller deques.
@Iearnwithme
6 ай бұрын
Great video again, very insightful! I have a DataFrame, for which I can also make into a list / a duque for each index I am interacting through where I am sorting the data. Would sorting be effected by the format? For context I am sorting all past constituents of the Russell 3000 back to 1990 sorting by market cap each day. Regardless, keep it up!
@DanielBoctor
6 ай бұрын
Thank you! I can't say for certain without more information, however DataFrames would almost certainly be the optimal way to sort data. They are specifically designed to handle and manipulate large datasets efficiently. My time complexity video actually dives into this topic a little bit, showing some of the advantages of vectorization and parallel computation, which are handled implicitly for you within DataFrames.
@Iearnwithme
6 ай бұрын
@@DanielBoctor Brilliant! I need to learn that - thank you for the guidance
Пікірлер: 12