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...

Комментарии • 40

  • @kundaichasinda9115
    @kundaichasinda9115 2 года назад +35

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

    • @ScornfulSix
      @ScornfulSix 6 месяцев назад

      Poor Claire 😭😭

  • @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.

  • @janh2403
    @janh2403 4 года назад +29

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

  • @k0.9486
    @k0.9486 2 года назад +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!

  • @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!

  • @helloworldcsofficial
    @helloworldcsofficial Месяц назад

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

  • @user-qo4bl2le7k
    @user-qo4bl2le7k 14 часов назад

    That claire part got me

  • @LilJollyJoker
    @LilJollyJoker 5 месяцев назад +1

    Thank you so much for this video!

  • @SiphepheloMlungwana
    @SiphepheloMlungwana 3 года назад +3

    wooow!, well explained thanks man...👌

  • @wadiibounenni4848
    @wadiibounenni4848 Месяц назад

    Helpful content

  • @carlosbarros6705
    @carlosbarros6705 2 года назад +1

    The best!!!! Thanks, man.

  • @codeuntildwan
    @codeuntildwan Год назад

    all my doubts cleared in a single vid regarding these topics

  • @fatimadarbandsari1870
    @fatimadarbandsari1870 3 месяца назад

    it was really helpful

  • @mahdiataei7625
    @mahdiataei7625 5 месяцев назад

    Thanks❤

  • @user-pj8ve1re6k
    @user-pj8ve1re6k 11 месяцев назад

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

  • @aymammetannamyradow8407
    @aymammetannamyradow8407 3 года назад

    useful video. thank you

  • @afshin.m8624
    @afshin.m8624 Год назад

    Tnx Caleb 💜

  • @kvelez
    @kvelez 10 месяцев назад

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

  • @mapalo111
    @mapalo111 5 месяцев назад

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

  • @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 2 года назад

      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?

  • @Troglodyte2021
    @Troglodyte2021 4 года назад

    Clearly explained!

  • @mamaafrica2512
    @mamaafrica2512 2 года назад

    where is top or head and tail parameters?

  • @dickheadrecs
    @dickheadrecs 2 года назад +2

    poor claire 😢

  • @BaconAndMinecraft
    @BaconAndMinecraft 4 года назад +1

    What IDE are you using? :)

  • @digital-zm
    @digital-zm 3 года назад

    The code is invisible

  • @skulves9677
    @skulves9677 7 месяцев назад

    toyota corrola chicken sandwich revolver god dangit

  • @Tech-vk2zk
    @Tech-vk2zk Год назад +2

    All my homies hate Claire

  • @liana9452
    @liana9452 3 года назад +2

    Hindi ko gets

    • @ample982
      @ample982 3 года назад

      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.

  • @superdahoho
    @superdahoho 2 года назад

    thanks caleb.
    you da man!