@greghogg5: A More Efficient Way to Implement a Stack Crack big tech at algomap.io! #coding #leetcode #programming #interview

Greg Hogg
Greg Hogg
Open In TikTok:
Region: CA
Monday 10 November 2025 16:02:05 GMT
15412
585
26
5

Music

Download

Comments

quantumnoob
quantumnoob :
ok everyone knows this chat a linked list is NOT underrated
2025-11-11 05:51:21
7
its.nate7
ItsMe :
or you can still use a dynamic array, but double the allocation size of the array for each insert that fills the array. It's amortized O(1)
2025-11-11 04:59:47
7
gkdkkfskfkkskfk
user2259260204545 :
not worth having to jump pointers every time you want any value, which is something you'd want from an array
2025-11-11 03:36:59
2
tyson_fn
Tyson :) :) :
This is not underrated lmao the most basic data structure you learn first, something like a skip list is very underrated and pretty much hard to implement tho
2025-11-10 20:42:27
4
__skull01
Pascal :
using a dynamic array is still O(1) amortized. considering how python lists work, not every time when you append and pop you'll have used all the space.
2025-11-11 12:27:13
0
tom_shabtay1
. :
Assuming int values and a 64 bit machine you just 3x the memory usage, just increase the size of the array by more then 1, the expected run time of insert will still be about constant
2025-11-11 02:28:47
1
ron.brami
🇮🇱Fuckplastelin :
Pointers are hard
2025-11-29 19:17:25
1
noah.virus
noah :
If bet this is actually slower than If the array like doubled or halved again, or you could do some hybrid
2025-11-11 12:28:58
0
mindless404
Mindless :
Learned about linked lists in the 1970s
2025-11-12 12:40:29
0
darkstar0111
anonymous dark star :
Its also bery memory inefficient
2025-11-10 21:43:16
2
its_alisaa
itsAlisaa :
if you have a max size for your stack, by far the fastest implementation is to just have a FIXED LENGTH array, and pop and append on the right
2025-11-10 16:51:42
1
ggjkdfkfcj
ggjkdfkfcj :
not cached cpu load is sloooow and it really depends what u are storing also if you have long lived array you tend to do less reallocations as time passes
2025-11-11 00:30:05
1
jakob_val
Jakob Schulz :
This is literally not really faster for most use cases. The dynamic array is O(1) as well just amortised. So in everything but real-time applications they are probably the better choice.
2025-11-10 21:58:09
2
romhulio
罗曼 :
memory fragmented
2025-11-10 16:52:42
3
user481475952
. :
Amortized O(1) with the dynamic array is still better than a linked list which isn't contiguous memory. People corrected you on this already on youtube shorts, come on man
2025-11-11 16:36:10
0
To see more videos from user @greghogg5, please go to the Tikwm homepage.

Other Videos


About