Convex Hull Jarvis March(Gift wrapping algorithm)

Поділитися
Вставка
  • Опубліковано 17 гру 2024

КОМЕНТАРІ • 87

  • @oussamajaballah7561
    @oussamajaballah7561 5 років тому +106

    There's always an Indian guy who can make you understand that algorithm you seek . Tushar is definitely the best of them :)

  • @SonuSonu-tk5pk
    @SonuSonu-tk5pk 7 років тому +32

    "hello friends my name is tushar "
    kaan taras jaate hai inn awaazen ko sunane ko
    happy to see u again

    • @tusharroy2525
      @tusharroy2525  7 років тому +7

      thanks

    • @chetanraikwar3546
      @chetanraikwar3546 6 років тому

      @@tusharroy2525 can you please make a video on *Suffix Array construction and applications* ? your suffix tree video was nice but you see, it's not so easy to implement. :( :( cover construction of Suffix array in nLogn or O(n) both version (DC3 algorithm) :/ also Persistent Segment Trees, Wavelet Trees etc :/ :/ *Suffix array a priority though ;)*

  • @girishgarg2816
    @girishgarg2816 4 роки тому +12

    Simplification:
    You always take the nextTarget as the 0th element and then proceed to find the true nextTarget. However, this will fail if the nextTarget point and the leftmost point is same. In that case the while loop will end just after the first point as the nextTarget doesnot change its value and at the end of the loop when it sees nextTarget==starrt, it will break. In order to account for this you have addded the concept of collinear points too in your program. But it will be very easy if you just initialise nextTarget=start+1 or (start+1)%n (for overflows) always inside the while loop. This will simplify the code. Thank you

  • @jaideeppyne1880
    @jaideeppyne1880 7 років тому +18

    Thanks, Tushar! For helping students across the globe to develop their knowledge in competitive programming :)

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

    To be honest , I have been looking at various convex hull videos, everyone is just explaining the code part , no one is talking abt the intution .... You have explained it in the best way possible

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

      I just wanna like this video from all my google accountss...........

  • @AntiGameZ
    @AntiGameZ 7 років тому +2

    Good to see you again. The video is terrific as always.

  • @kylcross
    @kylcross 7 років тому +1

    I'm so happy you're back. If you ever do a meetup up let me know. lol. You're literally my hero.

  • @ramcharanpalnati
    @ramcharanpalnati 7 років тому +1

    Thank you Tushar ....Your videos have given me strength to get the Job....

  • @stanisgmi
    @stanisgmi 7 років тому

    Super happy to see you back! Thanks so much

  • @Klaster961
    @Klaster961 7 років тому +9

    He is back again! :)

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

    @13:55 Would it have any impact to always set "Point nextTarget" as "start" instead of "points[0]"? This has probably been a part confusing me since I struggled to intuit how the Jarvis March algorithm is guaranteed convergence, and, is guaranteed to find only those boundary points as well.

  • @dineshchoudhary8221
    @dineshchoudhary8221 7 років тому

    Missed you so much!
    Welcome back.

  • @aditya.ishan27
    @aditya.ishan27 7 років тому +1

    You are the best teacher ever.

  • @olegon_yt
    @olegon_yt 6 років тому

    Tushar, your videos are awesome! Congratulations and thanks! :)

  • @Scy
    @Scy 6 років тому +3

    Great explanation of convex hull. Though the second part was bugging my OCD sensors.
    I think you've got some calculation errors. Vector AB is , whereas you have written it as , which is in fact the vector BA. Same with AC and AD, which you have turned into CA and DA. By coincidence the cross product is the same when you reverse both, but you would have trouble if you used those vectors individually for other things.
    Also a note on the cross product that is useful to know (maybe). Cross product is strictly a 3-dimensional vector operation, but we are "hacking it" in two dimensions by assuming z=0 and then returning the resulting cross product's z value as a scalar to determine the angular direction. Because the input z-values are 0, the output x and y values are automatically 0 (due to multiplication), so the only nonzero output result is the z value.

    • @lenordmelvix
      @lenordmelvix 5 років тому +2

      Thanks Scy. Yes, the order should be reversed

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

      Exactly what was bugging me .
      I started to doubt my years of intermediate Physics and mathematics haha.
      Thank you for the comment.

  • @VivekShah98
    @VivekShah98 6 років тому +2

    Can you please make video on Line Sweep Algorithm, I find it bit difficult to understand?

  • @akshaysuman8168
    @akshaysuman8168 7 років тому +3

    Hi Tushar, Good to see you back. Hope you will make more videos on dynamic programming.

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

    Thx for the video and your work!
    Small typo: to find a vector ac (vector from point a to point c),
    you need to subtract ending point c from starting point a:
    (c_x - a_x, c_y - a_y).
    Otherwise you end up with vector pointing out to opposite direction.
    Because the same typo procedure was repeated for all vector, cross
    product will be the same (cos -1 * - 1 = 1 * 1 , -1 * 1 = 1 * -1).

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

    in order to maintain points along the boundary in the same order, should we sort the collinear points in order of distance from the current point before adding to the results?

  • @aliakram1834
    @aliakram1834 5 років тому

    So what i think is just figuring out least point in x direction (-ev) will define left bound , max point in x direction (+ev) will define the right bound.Similarly the least point in y direction (-ev) will define lower bound and positive y point will define upper bound.I dont what will be the data input format.

  • @sauragra
    @sauragra 7 років тому +1

    Thanks Tushar.
    Please do some System Design questions.

  • @shawncaojob
    @shawncaojob 6 років тому

    Thank you Tushar. Great explanation!

  • @damchovic
    @damchovic 7 років тому +1

    good to see you again!

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

    I found code for Jarvis march on one of the russian sites This code is written in my favourite programming language
    On wikipedia code for Monotone chain can be found Monotone chain can be treated as simplified Graham's scan
    I had to introduce node counter to my doubly linked list to rewrite code for Monotone chain from wikipedia
    It was quite easy to rewrite code for Jarvis march from russian site

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

    what's the point of pushing collinear points in result? Aren't they redundant for convex hull?

  • @littlenarwhal3914
    @littlenarwhal3914 6 років тому

    So, i havent done vector mathematics in math class yet, but from what i understand, the cross-product of two vectors is a line perpendicular to both of them. But since there are always two way a line can go in 3d space to be prependicular to the two other vectors, how do you decide which way it goes (negative or positive). I see you have a thumb rule, but could you mathematically explain this to me?

  • @AsliKalakar
    @AsliKalakar 7 років тому

    thank you tushar sir , you are really amazing ..

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

    Which formula is used for finding cross product?

  • @VishalBhartivisu
    @VishalBhartivisu 7 років тому

    How do u make such a tough question so easy to understand...... Hats off...

  • @piyushkumar-wg8cv
    @piyushkumar-wg8cv 2 роки тому

    I am not getting why you used set to store result instead of array or vectors

  • @justinesdepiscis343
    @justinesdepiscis343 5 років тому

    Fantastic! What an explanation!! I suscribe lml

  • @ritukaushik1717
    @ritukaushik1717 7 років тому

    hi Tushar, can you do a video for "LRU cache" problem?

  • @chamilarathnayake
    @chamilarathnayake 7 років тому

    Do a video tutorial about "Treaps" insertion and deletion. There are not much videos related to that.

  • @marcusseidowski3320
    @marcusseidowski3320 5 років тому +1

    Hey, great video. I'm looking for Gift wrapping algorithm in three dimensions. Do you have any hints oder advices on how I can trasfer 2d to 3d solution?

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

      Instead of a line, take a plane and find whether any point lies above that plane. Definitely a pretty complex code but could be an interesting solve.

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

    I don't understand, shouldn't the cross product be in 3d only? you're performing the calculation to get the determinant here

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

      if I use the cross product formula setting the 3rd component to 0 it doesn't work

  • @arpitSheth1
    @arpitSheth1 5 років тому

    Thanks, Tushar!

  • @maneeshrajan3778
    @maneeshrajan3778 6 років тому +1

    great explanation sir. Please do this same for convex hull Graham's scan, line sweep.
    And if possible plz make video regarding parallel algorithms.

  • @Kreamax
    @Kreamax 7 років тому

    Great video, as always

  • @afrozasultanakakon
    @afrozasultanakakon 7 років тому

    I suppose it would be better to use collinearPoints.clear() in order to reset the collinear points.

  • @shwetakumari-ms2xg
    @shwetakumari-ms2xg 4 роки тому

    nice explanation.thanks

  • @piyushnarula3592
    @piyushnarula3592 5 років тому

    you cannot use set as it is for storing point object.

  • @aoi9716
    @aoi9716 7 років тому +1

    Good to see you.

  • @navanshu8703
    @navanshu8703 7 років тому

    hi tushar , can you talk something abt your experience working at apple , not usual algo stuff .

    • @tusharroy2525
      @tusharroy2525  7 років тому

      +Navanshu unfortunately can't. There is NDA.

  • @KeithSloan52
    @KeithSloan52 5 років тому

    Is there a similar algorithm for a 3D hull?

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

    Brilliant!!! Just Brilliant!!!

  • @SonuSonu-tk5pk
    @SonuSonu-tk5pk 7 років тому +1

    boss is here

  • @ignaciocalafate6605
    @ignaciocalafate6605 5 років тому

    This algorithm is based on the technique called greedy?

  • @SonuSonu-tk5pk
    @SonuSonu-tk5pk 7 років тому +3

    sir if u ever get free time please add videos on geomertic algorithms and advanced trees algorithms

    • @tusharroy2525
      @tusharroy2525  7 років тому +2

      which geometric algorithms?

    • @SonuSonu-tk5pk
      @SonuSonu-tk5pk 7 років тому +2

      Thanks for the concern sir...
      please make videos on line sweeping ,bipartite matching and light decomposition algorithm

  • @ashishsinha8893
    @ashishsinha8893 7 років тому +2

    sir I want to know learning to many language is important ya data structure and algorithm is more important with implemention...

    • @SonuSonu-tk5pk
      @SonuSonu-tk5pk 7 років тому +1

      if u r interested in competitive programming or targeting a good company ds and algos are must...
      language is just a way to transfer ur thoughts to computer .. if u know c++ then try to make ur STL as good as possible ...and then implement try to implement these algorithms...in the free time try to learn java and php

    • @ashishsinha8893
      @ashishsinha8893 7 років тому +1

      thanks buddy

  • @SunggukLim
    @SunggukLim 7 років тому

    Hi Tushar, Thank you for providing nice video. But it would be better if you have a nice mic.

  • @ArtyomPalvelev
    @ArtyomPalvelev 5 років тому

    Wait a sec, cross-product is a vector, not a number!

  • @naturesounds7153
    @naturesounds7153 6 років тому

    Thanks Tushar

  • @sadraxis
    @sadraxis 5 років тому

    love you, thanks

  • @varunaggarwal1995
    @varunaggarwal1995 7 років тому

    Thanks buddy😃

  • @mehranjalali5023
    @mehranjalali5023 6 років тому

    Tushar for the vector ab the correct value would be b-a instead of a-b please refer to math.stackexchange.com/questions/1703120/calculating-vector-ab-from-vector-a-and-b. The result is the same since you compute all of them wrong or with a factor of -1.

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

    Tushar is great

  • @markriad3910
    @markriad3910 6 років тому

    how can i modify this to get only the exterior points only ?

  • @greenitupp
    @greenitupp 7 років тому

    Need Graham and scan

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

    I think he lost his password...WHYYYY? Please make more videos

  • @the.indian.maniac
    @the.indian.maniac 6 років тому

    Thanks, Sir for this nice video. Can you please help by making a video on Sweep line algorithm. Thanks in advance :)

  • @SiddharthKulkarniN
    @SiddharthKulkarniN 7 років тому

    Super useful

  • @sadmanahmmed2214
    @sadmanahmmed2214 6 років тому

    graham scan plzz

  • @harpalsinhjadeja2568
    @harpalsinhjadeja2568 6 років тому

    make graham's algo also

  • @jarjeguzman5676
    @jarjeguzman5676 6 років тому

    Thanks

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

    you are not a good teacher though you know things. thanks for sharing

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

    hit like if u came to this video from UW CS341 also lmao

  • @ramandavid2047
    @ramandavid2047 6 років тому

    plllll-zzzzzzzz sir hindi me Lecture dea keje

  • @ashishsinha8893
    @ashishsinha8893 7 років тому

    I know c++