@greghogg5: A More Efficient Way to Implement a Stack #softwareengineering #softwaredevelopment #java #software #softwarejobs #softwareengineer #datastructures #leetcode #programming #javadeveloper #datastructuresandalgorithms #python #softwaredeveloper #code #FAANG #coding #javascript #javascriptdeveloper #codingisfun #codinginterview #js #html #css #sql

Greg Hogg
Greg Hogg
Open In TikTok:
Region: CA
Tuesday 14 May 2024 14:40:24 GMT
26354
1057
40
20

Music

Download

Comments

sukranyarogalah
rugalach :
linked list is less efficent than array as the memory allocated is not serial.
2024-05-14 20:43:30
9
dompster_diving
Dominic James :
i feel like a lot of your solutions consider what is the best runtime but not so much memory
2024-05-15 21:28:34
4
acam123acam
Acam123acam :
Amortized time of appending to a dynamic array can be O(1) if array size is scaled (eg 2*cur_size) not just increased by a constant. Nothing wrong with linked lists though.
2024-05-15 00:29:36
3
perunperunov
Perunov :
It depends. If your stack hovers around particular size you just create array of that size
2024-05-15 15:59:53
2
jormlormax
jorm :
in GC lang land this is a wash and completely depends on memory layout which you don’t control
2024-05-25 23:02:44
0
symnsez
SymnSez :
Pythons Deque is brilliant for single pop/inserts but only at start/ends
2024-05-14 20:53:33
0
nihariwithnaan
nihariwithnaan :
This depends if you’re gonna be get(I) and set(I)
2024-06-03 14:39:12
0
_hayden.smith_
Hayden Smith :
could you just do array length doubling with some initial size? this would be be Theta(n) on average for push but have O(1) pop, but have better spacial locality
2024-05-24 14:12:32
0
kuankuanaadi
Xy :
I'm learning a lot yet I'm still stuck in tutorial hell.
2024-07-17 05:06:39
0
marlo.sison
Marlo Sison :
that's not entirely correct. when there is enough memory after the array, some allocators will just extend the size. also,chances are, allocators usually reserve more space you reserve them for.
2024-05-15 18:39:02
0
will_g36
Will :
This is why Java can be nice for leetcode just create a new Stack and push and pop without worrying about efficient
2024-05-15 05:33:18
0
greghogg5
Greg Hogg :
I offer paid 1 on 1 tutoring services for data structures and algorithms / coding interview prep - please email [email protected] :)
2024-05-14 14:41:10
1
greghogg5
Greg Hogg :
I hope this was helpful, please drop a like if it was! Have a great day and follow me to see these in your feed daily :)
2024-05-14 14:41:26
1
connerrose7
Conner Rose :
So we don’t understand spatial locality
2024-05-15 15:30:18
14
borgerp
Malcus Anubis :
This is one of my pet peeves of python coding interviews - you need to memorize so many built in method runtimes
2024-05-14 19:32:51
2
greghogg5
Greg Hogg :
Stacks are a great data structure when we need the LIFO quality (the Last element to go in is the First to come out).
2024-05-14 14:40:46
0
userr696694
user699473 :
Doesn’t take advantage of cpu cache lining
2024-05-17 00:02:57
0
To see more videos from user @greghogg5, please go to the Tikwm homepage.

Other Videos


About