Sparse Table Algorithm Range Minimum Query

Поделиться
HTML-код
  • Опубликовано: 31 янв 2025

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

  • @sagarcs669
    @sagarcs669 7 лет назад +62

    You should maybe stop asking for likes and shares. No one in their good sense will dislike this video. You truly understand the various phases of the algorithm one finds difficulty grasping and try to cover them in meticulous and illustrative examples. You deserve an award for being only one of the kind of RUclips Channel that has a whole lot of algorithm explanation. Awesome Sir!

  • @Nikita-xk9fc
    @Nikita-xk9fc 5 лет назад +9

    114k subscribers are very less for u.I haven't seen ny video with this level of explanation.superb xplanation

  • @jfcahoon
    @jfcahoon 8 лет назад +5

    Just wanted to say thank you for all the work you've put into these videos and explanations. Your work has helped me immensely and I really appreciate it.

  • @nitinjain1325
    @nitinjain1325 7 лет назад

    khatarnak tarike se dhulai karte hai aap algorithms ki...use chupne ki jagah nahi milti.... u r great sir ji

  • @aayushbaniyal2124
    @aayushbaniyal2124 8 лет назад +1

    thanks for the videos... they were really helpful ... just know that because of you many students didn't got supply in algorithm course

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

    Great Explanation! Your videos are helping dev community a lot.

  • @anhdungoan2679
    @anhdungoan2679 6 лет назад +2

    This video is really useful, thank you very much, some people mistakenly thought the dislike button was a download button :D

  • @nguyenducvuanh48
    @nguyenducvuanh48 6 лет назад

    Thank you sir! I would have given up on the problem without this video.

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

    Wow , such a clean explanation , Thank You 💙

  • @AdityaPareek-c2u
    @AdityaPareek-c2u 8 месяцев назад

    I love this, great work sir

  • @imyashdeepsharma
    @imyashdeepsharma 8 лет назад

    That was very good explanation , cleared some of my doubts ! Thanks Tushar Sir :)

  • @NestorUA22
    @NestorUA22 6 лет назад +2

    Hi Tushar.
    Thank you for your video.
    I think for your viewers would be useful to explain the main idea of the algorithm with a sparse table.
    And this is as following:
    any range-interval [u,v] to divide onto two intersecting intervals [u,u+2^k-1] and [v+1-2^k,v] of length 2^k
    these two intervals are intersecting because by choice: 2^k

  • @s_cube8543
    @s_cube8543 5 лет назад

    Explanation of pseudo code at the end is what i love most in your videos.. literally it saved hours of my effort for understanding how this algos work.. and all these bcz u put days of effort into building this awesome videos. Such clean and clear explanations with examples. Thank you sooo much!! Hats off to you.
    Please keep uploading more. Also if possible put links to some problems related to this algos to practise. Thanks once again!

  • @dvnsravan
    @dvnsravan 8 лет назад

    Thanks for the explanation Tushar!

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

    Thanks bhai, finally understood how it works. :D

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

    Superbly Amazing! Thanks mate :)

  • @utuk123
    @utuk123 8 лет назад

    Awesome video Tushar sir

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

    Best explanation !

  • @thesavagetrader3681
    @thesavagetrader3681 7 лет назад

    Thanks sir for your great effort... very simple and easy explanation.

  • @christy_yinyan8449
    @christy_yinyan8449 8 лет назад +1

    Thank you so much! always the best!!!!

  • @AbhishekKumar-zz3ts
    @AbhishekKumar-zz3ts 8 лет назад

    sweet and simple explanation , keep it up :D

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

    Thank you. Very nice explanation.

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

    Great one!

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

    while doing the range query, why are we moving by k after we find the min in [query_L, K]? Since, we have already calculated for 2^k number of elements?

  • @hope-jh7bv
    @hope-jh7bv 3 года назад

    Thank you so much sir.

  • @AmanGarg95
    @AmanGarg95 8 лет назад +1

    Hi Tushar. If we were to do point updates at an index, then we would update all those entries at which the index in picture might contribute as a minimum to, right? This would be O(N logN) for N such point update queries. Am I correct in saying this?

  • @firefox-zzz
    @firefox-zzz 8 лет назад

    great as usual :D

  • @ShubhamJoshishubhamjoshi
    @ShubhamJoshishubhamjoshi 8 лет назад +3

    Thanks a lot :D could you please add one of LCA By RMQ also.

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

    Nice explanation. But Plz use another marker

  • @umangmalhotra1222
    @umangmalhotra1222 8 лет назад

    Hi tushar! what is the logic behind putting index of minimum numbers in table , you could have directly put the minimum value direct in the table.
    BTW nice video as always.

  • @raj1307
    @raj1307 6 лет назад

    great video sir :)

  • @front-rud
    @front-rud Год назад

    Thank you bro!

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

    Correct me If I'm wrong according to the sparse table being taught when i=4, j=0 in the first column, j will be 6 and i will be 7 and the min of both is 6 so the index of the 6 which is 1 should be returned right?

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

    thanks a lot sir :)

  • @RomanReigns-ds8hs
    @RomanReigns-ds8hs 5 лет назад

    thanks for the explanation.

  • @harshitgangwar1426
    @harshitgangwar1426 5 лет назад

    good explanation

  • @RomanReigns-ds8hs
    @RomanReigns-ds8hs 5 лет назад

    for range queries problems. which algorithm would be better?

  • @sahilgarg750
    @sahilgarg750 8 лет назад

    can we use sparse table for max min range query in a 2d array(matrix)?

  • @raghuramkarra15
    @raghuramkarra15 8 лет назад +1

    number of columns should be floor(log2(n))

    • @RomanReigns-ds8hs
      @RomanReigns-ds8hs 5 лет назад

      why??

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

      @@RomanReigns-ds8hs cp-algorithms.com/data_structures/sparse-table.html Read the Intuition part of the above link

  • @yuunpeeto8293
    @yuunpeeto8293 8 лет назад

    many thanks!

  • @rahulbhati3079
    @rahulbhati3079 5 лет назад

    can you upload some questions related to it

  • @bharatgulati8531
    @bharatgulati8531 6 лет назад

    wanted to give a double like to the video. but alas youtube restricted me two just one like.

  • @Himanshu-ed3mf
    @Himanshu-ed3mf 4 года назад +3

    Important point : if we have to find out sum of elements in range [L, R], then sparse table will give time complexity O(log N) not O(1)

  • @mousatat7392
    @mousatat7392 7 лет назад

    thank you very much

  • @sgulugulu19
    @sgulugulu19 6 лет назад

    Wouldn't it be more helpful if we store the elements directly..rather than their index

    • @dhruvreshamwala511
      @dhruvreshamwala511 6 лет назад

      Exactly what I was wondering

    • @dhruvreshamwala511
      @dhruvreshamwala511 6 лет назад +4

      Okay.. Got it.. The application of RMQ demands the storage of indices.. Because, usually, the minimum value is not just "Needed", it can also be updated.

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

    cout

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

    is this MO's algo ??

  • @vaibhavsharma8150
    @vaibhavsharma8150 8 лет назад

    thanku sir

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

    respect++

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

    Is it only me who listen keyboard smashing sound when he write something on board

  • @somnathgiri3245
    @somnathgiri3245 7 лет назад

    good

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

    G 17:23

  • @mayurkulkarni755
    @mayurkulkarni755 8 лет назад +1

    The time complexity to query RMQ Sparse Table in your implementation is log*(n) (not to be confused with log(n), log*(n) is iterated logarithm) which can be reduced to O(1) by choosing 2 [L,R] values such that they cover all the nodes. Read this for more www.topcoder.com/community/data-science/data-science-tutorials/range-minimum-query-and-lowest-common-ancestor/#Lowest%20Common%20Ancestor%20(LCA)

  • @Ashley_montz
    @Ashley_montz 6 лет назад

    does anyone know which problem in leetcode this is ?

  • @prudvim3513
    @prudvim3513 8 лет назад +6

    Hi tushar, I think Segment tree takes O(n log(n)) space and time for pre processing. Not O(N)

    • @saikumark6327
      @saikumark6327 6 лет назад

      the preprocessing time is o(nlogn)

    • @madankumarrajan1028
      @madankumarrajan1028 6 лет назад +1

      This is O(N) just the same way a heap construction algorithm takes O(N).

    • @malharjajoo7393
      @malharjajoo7393 6 лет назад

      @@madankumarrajan1028 Can you elaborate ? From my understanding, the heap construction algorithm time complexity is not very straight-forward to understand.
      Also, segment tree should be O(nlogn) according to me, since we use divide and conquer and then sum (in case of Range sum queries) the two child node values.

  • @yeeroj
    @yeeroj 5 лет назад +1

    Tushar bhai angrejo ki tarah English kyun bol rhe ho.....indian style English bol lo

  • @ShubhamKumar-rt8nb
    @ShubhamKumar-rt8nb 5 лет назад +1

    first of all you should explain the logic or why we are doing something

  • @uNabL3
    @uNabL3 6 лет назад

    Thank you!