Stacks and Queues (Python) - Data Structures and Algorithms

Поділитися
Вставка
  • Опубліковано 1 лют 2025

КОМЕНТАРІ • 42

  • @chelseypeck9573
    @chelseypeck9573 Рік тому +6

    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.

  • @kundaichasinda9115
    @kundaichasinda9115 3 роки тому +52

    "Gosh Claire, why do you always want to torment me?"

    • @ScornfulSix
      @ScornfulSix 10 місяців тому +1

      Poor Claire 😭😭

  • @k0.9486
    @k0.9486 3 роки тому +4

    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!

  • @janh2403
    @janh2403 4 роки тому +33

    You know that you can just write data[-1] to access the last element of the list?

  • @temp3219
    @temp3219 Рік тому

    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.

  • @aliceiselectric
    @aliceiselectric 2 роки тому +2

    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!

  • @kvelez
    @kvelez Рік тому +1

    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()

  • @SiphepheloMlungwana
    @SiphepheloMlungwana 4 роки тому +3

    wooow!, well explained thanks man...👌

  • @LilJollyJoker
    @LilJollyJoker 9 місяців тому +1

    Thank you so much for this video!

  • @helloworldcsofficial
    @helloworldcsofficial 6 місяців тому

    Can someone point me to the class implementation of the queue? Great vid Caleb. Thanks!

  • @superdahoho
    @superdahoho 2 роки тому

    thanks caleb.
    you da man!

  • @moego_0
    @moego_0 3 місяці тому

    queues in 4:47

  • @codeuntildwan
    @codeuntildwan Рік тому

    all my doubts cleared in a single vid regarding these topics

  • @user-pj8ve1re6k
    @user-pj8ve1re6k Рік тому

    i thought pop was only used for stacks and you are supposed to use deq for queues.. can you provide clarification on this?

  • @afshin.m8624
    @afshin.m8624 Рік тому

    Tnx Caleb 💜

  • @Mesrour
    @Mesrour 6 місяців тому

    Helpful content

  • @fatimadarbandsari1870
    @fatimadarbandsari1870 8 місяців тому

    it was really helpful

  • @kevinmapalo
    @kevinmapalo 10 місяців тому

    "Gosh Claire, why do you... always want to torment me?" oh Claire😭🤣

  • @aymammetannamyradow8407
    @aymammetannamyradow8407 4 роки тому

    useful video. thank you

  • @mahdia7625
    @mahdia7625 10 місяців тому

    Thanks❤

  • @mamaafrica2512
    @mamaafrica2512 3 роки тому

    where is top or head and tail parameters?

  • @dsvhs93
    @dsvhs93 3 роки тому

    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

    • @varunshrivastava2706
      @varunshrivastava2706 3 роки тому

      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?

  • @Balor-v7c
    @Balor-v7c 4 місяці тому

    That claire part got me

  • @Troglodyte2021
    @Troglodyte2021 4 роки тому

    Clearly explained!

  • @BaconAndMinecraft
    @BaconAndMinecraft 4 роки тому +1

    What IDE are you using? :)

  • @digital-zm
    @digital-zm 3 роки тому

    The code is invisible

  • @Tech-vk2zk
    @Tech-vk2zk Рік тому +3

    All my homies hate Claire

  • @skulves9677
    @skulves9677 Рік тому

    toyota corrola chicken sandwich revolver god dangit

  • @liana9452
    @liana9452 4 роки тому +2

    Hindi ko gets

    • @ample982
      @ample982 4 роки тому

      Sad

    • @tomcat9761
      @tomcat9761 2 роки тому

      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

  • @puzzlelovers529
    @puzzlelovers529 4 роки тому +1

    Can you do ASMR videos? Your voice sounds so soothing.

  • @maynardperalta3188
    @maynardperalta3188 3 місяці тому

    Absolute garbage. A stack is not a list. If you don’t know how to do it, don’t do it.

  • @carlosbarros6705
    @carlosbarros6705 2 роки тому +1

    The best!!!! Thanks, man.