Stacks and Queues

แชร์
ฝัง
  • เผยแพร่เมื่อ 1 ธ.ค. 2024

ความคิดเห็น • 127

  • @exodusfivesixfivesix8050
    @exodusfivesixfivesix8050 4 ปีที่แล้ว +3

    An entire 60minute class wrapped up into 15min. Nice work man.

    • @NERDfirst
      @NERDfirst  4 ปีที่แล้ว

      Hello and thank you very much for your comment! Glad you liked the video =)

  • @brianmaxx2837
    @brianmaxx2837 7 ปีที่แล้ว +6

    dude, you rocked this. best tutorial on a particular subject. A+.

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      Hello and thank you very much for your comment! Very happy to be of help =)

  • @jasonwu6446
    @jasonwu6446 8 ปีที่แล้ว +8

    You are better than the programming profs in university of waterloo, thank you!

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว +3

      Hello and thank you very much for your comment! Very happy to be of help =)

    • @notaweeboo469
      @notaweeboo469 5 ปีที่แล้ว

      Haha Waterloo!! Toilet university??

  • @akirawashere
    @akirawashere 8 ปีที่แล้ว +31

    great explanation man, thanks for your help!

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว +2

      You're welcome! Very happy to be of help =)

    • @nimoa.rashid9186
      @nimoa.rashid9186 6 ปีที่แล้ว

      You are Awesome person....ThankYOU sending you lots digital kisses

  • @Nonsense116
    @Nonsense116 6 ปีที่แล้ว

    only fantastic intro explanation to stacks and queues I could find on TH-cam. Thank you so much for putting the content together and doing all the work to get it here so we can enjoy.

    • @NERDfirst
      @NERDfirst  6 ปีที่แล้ว

      Hello and thank you very much for your comment! Very happy to be of help, and glad you liked the video =)

  • @YungPimp808
    @YungPimp808 8 ปีที่แล้ว +3

    I did not understand anything from my Professor, But Thanks to you , made it crystal clear.

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว

      Thank you very much! Very happy to be of help =)

  • @ganapatiavabrath7509
    @ganapatiavabrath7509 4 ปีที่แล้ว

    Your Lecture is very good quality, informative. Thank you sir

    • @NERDfirst
      @NERDfirst  4 ปีที่แล้ว

      You're welcome! Glad to be of help =)

  • @waterfiend3690
    @waterfiend3690 7 ปีที่แล้ว

    This is unbelievably helpful. An amazing, in depth explanation of both data structures!

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      Hello and thank you very much for your comment! That's great to hear, very happy to be of help =)

  • @mountainkat1719
    @mountainkat1719 4 ปีที่แล้ว

    Love this. I actually didn't know about the short cut for using the mod function.

    • @NERDfirst
      @NERDfirst  4 ปีที่แล้ว +1

      Hello and thank you very much for your comment! Glad you liked the video =)

  • @fantasylla4385
    @fantasylla4385 7 ปีที่แล้ว

    Great explantion man, it is clear, concise and short. Very helpful!!!!!

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      Hello and thank you very much for your comment! Glad to be of help =)

  • @Desireable725
    @Desireable725 8 ปีที่แล้ว

    Hello there! i just want to say this was the most clearest explanation of stacks and queues that has been explained to me. Thank you.

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว +1

      Hello and thank you very much for your comment! That's really great to hear - I'm very happy to be of help =)

  • @arjungurjar4600
    @arjungurjar4600 9 ปีที่แล้ว +1

    you're amazing . I really the love the way you explain things, you explained everything in a single video.
    thank you very much .

    • @NERDfirst
      @NERDfirst  9 ปีที่แล้ว

      +Yu Yureka You're welcome! Really glad you liked the video =)

  • @waldmilsonvilhete5833
    @waldmilsonvilhete5833 5 ปีที่แล้ว

    it's amazing. your explaination is straightforward. cool!

    • @NERDfirst
      @NERDfirst  5 ปีที่แล้ว

      Hello and thank you very much for your comment! Very happy to be of help =)

  • @oldnick1114
    @oldnick1114 6 ปีที่แล้ว +1

    Man.... You have elaborated pretty nicely!

    • @NERDfirst
      @NERDfirst  6 ปีที่แล้ว +1

      Hello and thank you very much for your comment! Glad you liked the video =)

  • @lincolnsand5127
    @lincolnsand5127 4 ปีที่แล้ว

    For the Queue: You could also store the last instruction as a bool (true for remove and false for add). Then if the pointers are pointing to the same and the last instruction wad remove, it's empty and vice versa for full. Then you don't need to keep around an extra empty wasted slot in the Queue. This is slightly nicer and more efficient imo.

    • @lincolnsand5127
      @lincolnsand5127 4 ปีที่แล้ว

      I just used add and remove instead of enqueue and dequeue because of brevity

    • @NERDfirst
      @NERDfirst  4 ปีที่แล้ว

      Hello and thank you for your comment! That's a cool approach, thank you for sharing.

  • @SamarKhan-pq9jc
    @SamarKhan-pq9jc 9 ปีที่แล้ว

    hey very nice video!!! i missed my classes on the topic in school and the video was a really big help!! strongly recommended!

    • @NERDfirst
      @NERDfirst  9 ปีที่แล้ว

      +Samar Khan Thank you very much! Happy to be of help =)

  • @davidchiumeraable
    @davidchiumeraable 7 ปีที่แล้ว

    Great video. It was long, but if you take it slow you come out with a great understanding. Thanks for the info brother :)

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว +1

      Hello and thank you very much for your comment! Sorry about the length - I'm glad you found it useful regardless!

  • @salthesadmanshark5645
    @salthesadmanshark5645 3 ปีที่แล้ว

    still useful in 2021. thanks for the video (from the future) :3

    • @NERDfirst
      @NERDfirst  3 ปีที่แล้ว

      You're welcome! Very happy to be of help =)

  • @MrMineHeads.
    @MrMineHeads. 4 ปีที่แล้ว

    Lovely explanation!

    • @NERDfirst
      @NERDfirst  4 ปีที่แล้ว +1

      Hello and thank you for your comment! Glad you liked the video =)

  • @kishorsubedi4215
    @kishorsubedi4215 7 ปีที่แล้ว +3

    So, for a queue, if the queue is empty, both pointers overlap. I get it.
    But when it is full, you said that it is full only when back pointer is to the left of front, right?
    That means there is a space for another element to append, but we already declared it to be full, HOW>???

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว +3

      Hello and thank you for your comment! As described at 12:01, this is by design - We deliberately leave a gap in the array to distinguish between the "queue full" and "queue empty" states. You don't _have_ to do things this way, but this is the simplest.

  • @SkillUpMobileGaming
    @SkillUpMobileGaming 2 ปีที่แล้ว

    Resize the stack if it is full (which only happens with arrays) - don't throw an error. Just put all of the elements into a larger array.

    • @NERDfirst
      @NERDfirst  2 ปีที่แล้ว

      Hello and thank you for your comment! That's certainly something you could do, and would be useful in a practical context. However, this is generally out of scope in the classic definition of a stack, which is why it is omitted here.

  • @sulaimansulaiman1309
    @sulaimansulaiman1309 7 ปีที่แล้ว

    sir it's very amazing i like this one lecture so much!!!!!!!!!!!!!!!!!!!!!

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      Thank you! Happy to be of help =)

  • @onlinejobsethiopia7173
    @onlinejobsethiopia7173 6 ปีที่แล้ว

    Thanks, brother...it was a great explanation.

    • @NERDfirst
      @NERDfirst  6 ปีที่แล้ว +1

      You're welcome! Happy to be of help :)

  • @danielyarboi5326
    @danielyarboi5326 5 ปีที่แล้ว

    keep it up, your explanation really helpful.

    • @NERDfirst
      @NERDfirst  5 ปีที่แล้ว +1

      Hello and thank you for your comment! Glad to be of help =)

  • @zachshields9913
    @zachshields9913 7 ปีที่แล้ว

    Awesome! Really an informative tutorial!!

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว +1

      Hello and thank you very much for your comment! Very happy to be of help =)

  • @samchan2535
    @samchan2535 8 ปีที่แล้ว +1

    lucid explanation, man! Thank you for this!

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว

      Thank you very much! Glad you found the video useful =)

  • @rishabhjha447
    @rishabhjha447 6 ปีที่แล้ว

    This video is Awesome. 😇😇 Please post some more videos on Data Structures and algorithms.

    • @NERDfirst
      @NERDfirst  6 ปีที่แล้ว

      Hello and thank you very much for your comment! I definitely will, more to come :)

  • @ceilingwalker1
    @ceilingwalker1 6 ปีที่แล้ว

    Awesome explanation! Subscribed.

    • @NERDfirst
      @NERDfirst  6 ปีที่แล้ว

      Hello and thank you very much for your comment and support! Hope to see you around on the comments of new videos to come =)

  • @poojamanjunatha341
    @poojamanjunatha341 6 ปีที่แล้ว

    Hello sir. This video was very good and useful as well. I would like to get the updates of other videos related to data structures 😊

    • @NERDfirst
      @NERDfirst  6 ปีที่แล้ว

      Hello and thank you for your comment! If you would like updates, please subscribe to the channel! You can also find playlists on my profile for videos classified by topic.

  • @atindroroychowdhury8072
    @atindroroychowdhury8072 4 ปีที่แล้ว

    thanks for the explanation man!

    • @NERDfirst
      @NERDfirst  4 ปีที่แล้ว

      You're welcome! Happy to be of help =)

  • @Earlandia
    @Earlandia 7 ปีที่แล้ว

    This was wonderful! Thanks so much for your help :)

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      You're welcome! Very happy to be of help!

  • @weezy59552
    @weezy59552 8 ปีที่แล้ว

    Thanks for this video, this is very clear !

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว

      You're welcome! Very happy to be of help =)

  • @bbs-3358
    @bbs-3358 4 ปีที่แล้ว

    great explanation in very details. thanks
    Could you do a BigO natation video for new beginner?

    • @NERDfirst
      @NERDfirst  4 ปีที่แล้ว

      You're welcome! I have some videos on Big O Notation. Perhaps you might want to start on my series "Asymptotic Notations": th-cam.com/play/PLJse9iV6Reqh5B_w9koGyT7nlYm92iITk.html

  • @BotanTechHelp
    @BotanTechHelp 8 ปีที่แล้ว

    This helped me out very much.
    Thank you.
    Tip for improvement, it would be awesome if you included pseudocode for both stacks and queues :D

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว +1

      +Boti Bot Hello and thank you very much for your comment! Happy to be of help =)
      Normally, if I can help it, I avoid showing pseudocode in my videos. The reason for this is because I notice that many learners focus too much on the pseudocode before getting the intuition - That's why my focus is on getting the intuition right!

  • @coldsummersky69
    @coldsummersky69 9 ปีที่แล้ว

    your explanations are very good and easy to understand for all levels of knowledge, but more visual would really help people to stay focused. saying this because i can see this channel growing,especially with all the bootcamps students are all youtubing for clear understanding. like myself

    • @coldsummersky69
      @coldsummersky69 9 ปีที่แล้ว

      actually u use fair amount of visual ;)

    • @NERDfirst
      @NERDfirst  9 ปีที่แล้ว +3

      +Dany Han Hello and thank you very much for your comments =) Generally my principle is to adopt "just enough" visuals. Unfortunately I'm a full time student doing this as a hobby on the side, so I don't really have the time to go beyond the strictly necessary.

  • @mihirapremadasa993
    @mihirapremadasa993 7 ปีที่แล้ว

    Thank you. Good explanation.

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      You're welcome! Very happy to be of help =)

  • @BotanTechHelp
    @BotanTechHelp 8 ปีที่แล้ว

    Hey buddy. Awesome video, just wanted to ask:
    My OCR A level computer science, hodder education, text book states that to push data to a stack, you increment pointer then push, whereas you have said you push then increment. Is my text book incorrect, or have I understood you incorrectly?
    Thank you

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว +1

      Heya Boti Bot =)
      Interestingly, neither is wrong! The meaning behind the stack pointer can change, and it is the semantics that dictates the implementation.
      My method (push then increment) works because my stack pointer points to the _next free space_ on the stack. Hence, of course it makes sense to push to that space before I move the pointer up. Your textbook's method (increment then push) works because their stack pointer points to the _topmost item_. You don't want to replace that item on push! Instead, you want to climb up to the next free space before insertion.
      Of course, it's important to know that checking for stack empty and full conditions will be different also depending on the meaning of the stack pointer! I'll let you figure out where the differences are (an "exercise for the reader", so to speak), let me know if you need more hints =)

  • @sayantanpanda3049
    @sayantanpanda3049 6 ปีที่แล้ว

    Really helpful,thanks dude

    • @NERDfirst
      @NERDfirst  6 ปีที่แล้ว

      You're welcome! Very happy to be of help =)

  • @omaraziz229
    @omaraziz229 6 ปีที่แล้ว

    thanks man u make it really easy understanding , get SUBSCRIBE YOU DESERVE IT, BEST REGARDS

    • @NERDfirst
      @NERDfirst  6 ปีที่แล้ว

      Hello and thank you very much for your comment and support! Glad you liked the video and hope to see you around in the comments section of more videos to come =)

  • @bizu2603
    @bizu2603 7 ปีที่แล้ว

    nice explanation ,great job!, can you make more videos about microcontrollers ?

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      +Andrew Gheorghiu Hello and thank you for your comment! Unfortunately I don't have a lot of experience with microcontrollers! But I'm currently seeing what I can do with my raspberry pi. If I figure something out I'll work on some vids!

  • @gonespral
    @gonespral 7 ปีที่แล้ว

    great vid, subscribed

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      Thank you very much for your comment and support! Looking forward to hearing more from you In the comments section of future videos.

  • @Zacadea
    @Zacadea 7 ปีที่แล้ว

    Great explanation thank you!

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว +1

      +Zacadea You're welcome! Very happy to be of help!

  • @kirankiran-zx5yp
    @kirankiran-zx5yp 8 ปีที่แล้ว

    plz explain about circular and priority queues.....

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว

      +kiran kiran Hello again! The queue covered in this video is already a circular queue, so that's already available.
      As mentioned, efficient priority queues require a lot more background to understand, so I'll put that on the list for a later time.

  • @user-lu4uo1wj5o
    @user-lu4uo1wj5o 5 ปีที่แล้ว

    Thanks a lot!

    • @NERDfirst
      @NERDfirst  5 ปีที่แล้ว

      You're welcome! Very happy to be of help =)

  • @pelinceliksoz1072
    @pelinceliksoz1072 5 ปีที่แล้ว

    It's great!

    • @NERDfirst
      @NERDfirst  5 ปีที่แล้ว

      Hello and thank you for your comment! Happy to be of help =)

  • @kirankiran-zx5yp
    @kirankiran-zx5yp 8 ปีที่แล้ว

    please explain about types of queues

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว

      +kiran kiran Hello and thank you for your comment! I'm not sure how that would fit into a video though... Different types of standard queue aren't all that varied. And looking at more complex variants like Priority Queues would require a lot of additional background, so both ways feels awkward!
      Do you have any idea in mind of what you would like to see in a video about types of queues?

  • @tianjingguo5348
    @tianjingguo5348 7 ปีที่แล้ว

    Thanks. And by the way, I like your accent!

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว +1

      You're welcome! The accent isn't really natural, but I'm glad you like it!

  • @IgustiFajar
    @IgustiFajar 4 ปีที่แล้ว

    Kelas Strukdat A mana suaranya!!!!

  • @bluechampions3418
    @bluechampions3418 5 ปีที่แล้ว

    thank you very much

    • @NERDfirst
      @NERDfirst  5 ปีที่แล้ว

      You're welcome! Very happy to be of help =)

  • @flamela-c4f
    @flamela-c4f 8 ปีที่แล้ว

    Er, directly left? What if we filled the queue without a single dequeue?

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว

      +main_gi It's still directly left - That's the beauty of a circular buffer! To implement this on a simple flat array, we apply the "wrap around" condition, so that the element directly to the left of the first item is at the far right of the array.

    • @flamela-c4f
      @flamela-c4f 8 ปีที่แล้ว

      Yeah, I get that wouldn't be too hard to implement, but it does seem an edge case that could be made more simple somehow instead of if f-b = 1 OR (b = len(array) AND f = 0).

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว +3

      +main_gi Oh, I don't think you need to check for multiple conditions like that. We can ascertain that the back pointer is "left" of the right pointer by doing:
      if ( (back+1)%len == front ) {
      // Queue is full
      }
      This works for all cases, corner or otherwise.

    • @flamela-c4f
      @flamela-c4f 8 ปีที่แล้ว +1

      Oh, uh, crap. I guess that works too! Hm... in code complexity, how is using modulo in terms of performance versus edge cases?

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว

      +main_gi Hehheh, yeah, I actually didn't realize it could be that simpler either. I teach the tutorials for an undergrad course at my uni, and when I saw that method in the answer sheets, I was like, oh, that's smart.
      I honestly have no clue about the performance! The modulo operator is known to be slow, so depending on the architecture, checking say, 3 or so conditions for equality might be faster than performing modulo. But this is very much micro-optimization, and I doubt the impact will be perceptible.

  • @kingexplosionmurder9765
    @kingexplosionmurder9765 7 ปีที่แล้ว

    THANK YOU!

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      You're welcome! Glad to be of help =)

  • @odb3005
    @odb3005 8 ปีที่แล้ว

    Thank you mate! (:

    • @NERDfirst
      @NERDfirst  8 ปีที่แล้ว

      You're welcome! Very happy to be of help =)

  • @itheblackwolfofmyfamily
    @itheblackwolfofmyfamily 6 ปีที่แล้ว

    What is 0612?

    • @NERDfirst
      @NERDfirst  6 ปีที่แล้ว

      It comes from my birthday! I know, it's lame and but I picked it ages ago and it stuck!

  • @vatsk
    @vatsk 5 ปีที่แล้ว

    Oof well explained friend, thank you

    • @NERDfirst
      @NERDfirst  5 ปีที่แล้ว

      You're welcome! Very happy to be of help =)

  • @LANstorm.
    @LANstorm. 5 ปีที่แล้ว

    Nice

    • @NERDfirst
      @NERDfirst  5 ปีที่แล้ว

      Thank you! Glad you liked the video =)

  • @WakeWorkRepeat
    @WakeWorkRepeat 7 ปีที่แล้ว +3

    Thanks my lil' Asian nigga

    • @NERDfirst
      @NERDfirst  7 ปีที่แล้ว

      You're welcome! Very happy to be of help =)

  • @austinsandoval1689
    @austinsandoval1689 9 ปีที่แล้ว

    hey bud great channle im going to subscribe and wannted to know if you can help me out with the following ideas
    model and protocol stack, implementation details of various network protocols, ROUTING ALGORITHMS

    • @NERDfirst
      @NERDfirst  9 ปีที่แล้ว

      +austin sandoval Hello and thank you for your comment! Unfortunately, networking has never been a particularly strong point for me, and I'm not familiar with any of the topics you've mentioned. I'll look them up, but whether or not I'll do videos on them depends on how well I can understand them!

  • @keyvanshabani6251
    @keyvanshabani6251 5 ปีที่แล้ว

    just realized that my professor sucks LOL

    • @NERDfirst
      @NERDfirst  5 ปีที่แล้ว

      Hello and thank you for your comment! It's unfortunate, but sometimes in university, professors have to cover a lot of the underlying theories and math, so that's why! I don't blame them, but I'm glad I could help you fill in the gaps!

  • @DelroyBarnies
    @DelroyBarnies 10 หลายเดือนก่อน

    amazing explanation thanks!!

    • @NERDfirst
      @NERDfirst  10 หลายเดือนก่อน

      You're welcome! Very happy to be of help :)