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 :)
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
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.
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!
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.
This is legendary content, so glad I found this gem that unearths low level concepts from high level ones, especially in Python
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
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 :)
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
@@DanielBoctor In C it's surprisingly also a single line, btw! `arr[i] = arr[--len];`
What a beautiful line of code
I love how you teach so much in just 3 minutes
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.
n / 2 isn't a time complexity? You could have been more clear with that last part
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!
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.
@@DanielBoctor Brilliant! I need to learn that - thank you for the guidance
bro.......
it's literally a first yr chapter