Comp Sci in 5: Shunting Yard Algorithm

แชร์
ฝัง
  • เผยแพร่เมื่อ 17 ต.ค. 2017
  • There is no code here, just go over the logic of the algorithm and an example. If you can remember the logic, then you can create it whenever you need it!

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

  • @pawlstothewall
    @pawlstothewall 3 ปีที่แล้ว +42

    Isn't your infix expression invalid? There is a random multiplication hanging out between the '3' and the ')'. If I'm incorrect, please explain for me. Thanks.

  • @ematsuno
    @ematsuno 5 ปีที่แล้ว +35

    An incredible amount of explanation in the shortest amount of time. Bravo!

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

      Thanks Eric, your comment really means a lot!

    • @compsciin5932
      @compsciin5932  3 ปีที่แล้ว +1

      Thank you Eric!

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

    your demeanor and clear way of speaking makes this so much less stressful. Thank you

    • @compsciin5932
      @compsciin5932  3 ปีที่แล้ว +2

      Absolutely my pleasure! Thank you for taking the time to write this comment

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

    you are a god to us mortal compsci students. god bless your soul.

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

      Thanks for leaving this comment bro!

  • @antoninedelchev6076
    @antoninedelchev6076 5 ปีที่แล้ว +11

    I don't know if you still read the comments on your videos, but I want to thank you for taking the time to explain this algorithm in a clear, simple and quick way.

    • @compsciin5932
      @compsciin5932  3 ปีที่แล้ว +1

      You are most welcome Antoni

    • @compsciin5932
      @compsciin5932  3 ปีที่แล้ว +1

      Comments like yours really touch my heart thank you for taking the time to write them

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

    very informative. Loved the visualization of the queue and operators. Keep posting. Luv your videos

  • @amihartz
    @amihartz 3 ปีที่แล้ว +2

    The visual representation here is very helpful! Thank you!

  • @brianwsmithers
    @brianwsmithers ปีที่แล้ว

    Excellent visual explanation. I inherited a class project that utilizes this algorithm so I'll be referring to this video often! Much appreciation.

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

      Thanks man! Appreciate you taking the time to send me this message. Good luck in your project !

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

    Amazing video you created! Thanks so much

  • @markslab2960
    @markslab2960 3 ปีที่แล้ว +2

    thanks a lot man . I passed the exam with this video.

    • @compsciin5932
      @compsciin5932  3 ปีที่แล้ว +1

      You are most welcome! I am happy that this was helpful for you bro

  • @fred-ho2yf
    @fred-ho2yf 2 ปีที่แล้ว

    thank you for your clear explanations

  • @dulalghose1347
    @dulalghose1347 4 ปีที่แล้ว +2

    Sir please continue your videos they are awesome... I just saw today

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

      Wow thank you for writing this comment!

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

    Concise video, great stuff! Cheers

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

    Sir You made this algorithm very easy to visualize, Great explanation

    • @kurtishaut910
      @kurtishaut910 2 ปีที่แล้ว +1

      Thank you buddy, appreciate your kind words

  • @Emir-yo8ek
    @Emir-yo8ek 8 วันที่ผ่านมา

    glad for ur effort sir

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

    Great explanation. Thank you kind sir.

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

    good stuff. i liked your energy

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

      Thank you, It’s tough to get excited about the shunting yard but I tried lol

  • @mjthebest7294
    @mjthebest7294 2 ปีที่แล้ว +5

    Omg! It was sooo good. How about functions, unary operators and composite functions? I would love to see some practical examples:D

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

    very intuitive , thank you

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

      You are welcome, glad to hear it!

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

    Best explanation ever

  • @xSteelCatx
    @xSteelCatx 6 ปีที่แล้ว +24

    What kind of expression is: (5*4+3*)-1 ?
    It should cause a syntax error

    • @compsciin5932
      @compsciin5932  6 ปีที่แล้ว +19

      Hey Daniel,
      You are right it would cause a syntax error :/. To be 100% honest, There is supposed to be a 2 right after the * and before the ).
      I cut one of those out, and had it in, however, on the second or third take it went MIA lol
      Hopefully the core concepts are still there !

    • @farrukhsaif108
      @farrukhsaif108 3 ปีที่แล้ว +2

      @@compsciin5932 I started questioning my own existence and even tried to execute that in python to make sure I wasn't tripping xd

    • @compsciin5932
      @compsciin5932  3 ปีที่แล้ว +2

      @@farrukhsaif108 Lol that is hilarious

  • @videodude5337
    @videodude5337 ปีที่แล้ว

    Thank you!

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

    Best explanation ever, better then my teachers explanation :D

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

      Wow thanks man! Appreciate the kind words d:^)

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

    Amazing!

  •  5 ปีที่แล้ว +3

    This would fail for exponentiation, because of the associativity. You have to check for left vs. right associativity of operators before pushing onto the stack.

    • @kurtishaut910
      @kurtishaut910 5 ปีที่แล้ว +2

      There are plenty of examples out there that people can grab the code from, these videos are just trying to hit at the main concepts

  • @bikramghosh3167
    @bikramghosh3167 ปีที่แล้ว

    yes 2023 we are here

  • @user-sq6uu3xx6u
    @user-sq6uu3xx6u 8 หลายเดือนก่อน

    Buen video

  • @Ajaykrishna97_
    @Ajaykrishna97_ 7 หลายเดือนก่อน

    What is the precedence of logical operators "||" and "&&"

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

    thank you so much this was very helpful - but just a quick question - what is the purpose of this? Like why does it do this? And if we relate it to the algorithm, such as I am thinking of the youtube algorithm, how does this relate?

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

      The shunting yard algorithm is generally used in calculators and mathematical computations.

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

    excellent video.

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

      Thank you

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

      @@compsciin5932 Dont stop making videos , please. They are very logical and you really are a good teacher. I hope this channel grows.

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

    thanks sir

  • @TheSharkasmCrew
    @TheSharkasmCrew 11 หลายเดือนก่อน

    Awesome visualization, but how do you evaluate the RPN if there's two operators in a row? e.g. in your example you have 5,4,*,3,*,+,1,-
    So we multiply 4 and 5 together, then take the result and multiply it with 3, then take that result and add it to what exactly?

    • @TheSharkasmCrew
      @TheSharkasmCrew 11 หลายเดือนก่อน +1

      oh nvm I just replayed the vid and it's because your original example was malformed LOL `(5*4+3*)-1` isn't a proper expression

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

    Thanks

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

    What if we push sin ,cos

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

    AdventOfCode2020 participants, welcome!

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

    Great explanation...

  • @BulalarTeam
    @BulalarTeam ปีที่แล้ว

    Why (5*4+3*)-1?

  • @FaultedPath
    @FaultedPath 3 ปีที่แล้ว +1

    lol what was with the intro? XD

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

      Yeah idk too much coding LOL

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

    Great and all but it is rather annoying that it wasnt 100% clear that - - also should be pushed to the postfix like this:
    3-1-1
    Is 31-1-
    And not 311-- as i assumed.
    I only noticed after my code gabe me the wrong result.
    Same goes for /* , */, +- and -+. At least for me.

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

    that intro was earrape

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

      You are quite right about that, my apologies

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

    Really helpful. Pity about the missing 2 but it doesn't affect how understandable it is.

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

      I am really happy to hear that it was helpful :-) There was a 2 in there in a previous take (as I am sure you inferred) but it went MIA haha

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

    Dude, that shout at the beginning was freaking horrible! Whhhhhyyyy???!!! Other than that, it's a very informative video.

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

      Lmao I am one of those guys who laughs at their own jokes