Stacks and Queues (Python) - Data Structures and Algorithms
HTML-код
- Опубликовано: 8 сен 2024
- Start your software dev career - calcur.tech/de... 💯 FREE Courses (100+ hours) - calcur.tech/al...
🐍 Python Course - calcur.tech/py...
✅ Data Structures & Algorithms - calcur.tech/ds...
~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~
✉️ Newsletter - calcur.tech/ne...
📸 Instagram - / calebcurry
🐦 Twitter - / calebcurry
🔗 LinkedIn - / calebcurry
▶️ Subscribe - calcur.tech/sub...
👨🏻🎓 Courses - www.codebreakt...
~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~
↪ My Amazon Store - www.amazon.com...
🅿 Patreon - calcur.tech/pat...
🅖 GitHub Sponsors - github.com/spo...
Ⓟ Paypal - paypal.me/calcur
🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
📈 Buy Bitcoin - calcur.tech/cr...
Reserve the Ruby Steel crypto rewards card and get a $25 bonus (use affiliate code "Caleb") - calcur.tech/cr...
"Gosh Claire, why do you always want to torment me?"
Poor Claire 😭😭
I enjoy both kinds of videos you do. In person, and actually coding. I love the switch up of content. Really helps me pay attention and learn items from different perspectives.
You know that you can just write data[-1] to access the last element of the list?
and who is clair?
you can use arr[ : : -1] to reverse the array
I think there is a lot of value derived from both the conceptual and hands on, I'd suggest staying with both for different types of learners!
What troubling me was why in python we just use an array for a stack for just pop and push, when you can just get array[ 2] or [3] easily. The fact that you mentioned "we just have to limit its usage to make it work like a stack" is what cleared my head. LOL. And the stack implementation using the class at the end was perfect. Thank you dowg.
Really helpful video, and I watched quite a few others before this one. Yours had the perfect balance between being objective but also not superficial. Thanks!
Can someone point me to the class implementation of the queue? Great vid Caleb. Thanks!
That claire part got me
Thank you so much for this video!
wooow!, well explained thanks man...👌
Helpful content
The best!!!! Thanks, man.
all my doubts cleared in a single vid regarding these topics
it was really helpful
Thanks❤
i thought pop was only used for stacks and you are supposed to use deq for queues.. can you provide clarification on this?
useful video. thank you
Tnx Caleb 💜
class Stack:
def __init__(self, limit):
self.stack = []
self.limit = limit
def get_length(self):
return len(self.stack)
def push_stack(self, data):
if self.get_length() < self.limit:
self.stack.append(data)
else:
raise Exception("Stack is full")
def pop_stack(self):
if self.get_length() > 0:
self.stack.pop()
else:
raise Exception("Stack is empty")
def insert_at(self, index, data):
if self.get_length() < self.limit:
self.stack.insert(index, data)
else:
raise Exception("Invalid stack insertion")
def remove_at(self, index):
if self.get_length() > 0:
self.stack.pop(index)
else:
raise Exception("Invalid stack removal")
def show_stack(self):
print(self.stack)
def peek_stack(self):
print(self.stack[-1])
stack = Stack(limit=6)
stack.push_stack("a")
stack.push_stack("b")
stack.push_stack("c")
stack.insert_at(1, "z")
stack.remove_at(3)
stack.pop_stack()
print(stack.get_length())
stack.peek_stack()
stack.show_stack()
"Gosh Claire, why do you... always want to torment me?" oh Claire😭🤣
Caleb I beg of you to make one of these for Java lol I feel like they would be super similar but I also get confused
Don't worry man, Let me suggest you THE BEST dsa course on java. Just search Kunal Kushwaha on youtube. I can guarantee you , you are gonna love it . Its literally the best course out there. But still don't listen to me just give it a try. And one last thing do give me reviews whether you like that or not, will ya?
Clearly explained!
where is top or head and tail parameters?
poor claire 😢
What IDE are you using? :)
Vsc
The code is invisible
toyota corrola chicken sandwich revolver god dangit
All my homies hate Claire
Hindi ko gets
Sad
Basta pre pag Stacks = LIFO. Meaning kung ano ung last element, aun lagi ung magagalaw (append/push, or ma-pop, or peek).
Sa queue naman = FIFO. Kung ano ung una, ayun ung matatanggal. (append/push
Can you do ASMR videos? Your voice sounds so soothing.
wtf
I dont think Claire would be comfortable with that.
thanks caleb.
you da man!