Range Update Query | Lazy Propagation | Segment Tree Concepts & Qns | Video 7 | codestorywithMIK

SdĂ­let
VloĆŸit
  • čas pƙidĂĄn 27. 07. 2024
  • iPad PDF Notes - github.com/MAZHARMIK/Intervie...
    Whatsapp Community Link : www.whatsapp.com/channel/0029...
    This is the 7th video of our playlist "Segment Tree Concepts & Questions". Find the Details below :
    Video Name : Range Update Query | Lazy Propagation | Segment Tree Concepts & Qns | Video 7 | codestorywithMIK
    Video # : 7
    🔍 Unraveling Segment Tree : A Journey into the Depths of it.
    đŸŽ„ Welcome to the 7th Video of my Segment Tree Concepts & Questions Playlist! 🚀 In this enlightening video, we will finally start solving Qns on Segment Tree. In this one, we will solve - Range Update Query | Lazy Propagation | Segment Tree Concepts & Qns | Video 7 | codestorywithMIK
    🔍 What's Inside ?
    🔗 We will see how we can use Segment Tree concepts to easily solve this problem - Range Update Query | Lazy Propagation | Segment Tree Concepts & Qns | Video 7 | codestorywithMIK
    đŸ‘©â€đŸ’» Who Should Watch ?
    This playlist is for everyone but best suited for Freshers who are new to Segment Tree.
    🚀 Embark on the Segment Tree Adventure Now!
    Problem Name : Range Update Query | Lazy Propagation | Segment Tree Concepts & Qns | Video 7 | codestorywithMIK
    Company Tags : Google and many other companies ask problems based on this topic
    My solutions on Github(C++ & JAVA) : github.com/MAZHARMIK/Intervie...
    GfG Link : www.geeksforgeeks.org/lazy-pr...
    My DP Concepts Playlist : ‱ Roadmap for DP | How t...
    My Graph Concepts Playlist : ‱ Graph Concepts & Qns -...
    My Recursion Concepts Playlist : ‱ Introduction | Recursi...
    My GitHub Repo for interview preparation : github.com/MAZHARMIK/Intervie...
    Subscribe to my channel : / @codestorywithmik
    Instagram : / codestorywithmik
    Facebook : / 100090524295846
    Twitter : / cswithmik
    Summary :
    The provided code implements a segment tree with lazy propagation for efficiently updating a range of values and querying the sum over a range. Here's a brief summary:
    Time and Space Complexity
    Time Complexity (T.C): O(logn)
    Space Complexity (S.C): O(n)
    Segment Tree and Lazy Propagation
    Segment Tree: An array representation of the segment tree where each node stores the sum of a segment of the array.
    Lazy Tree: An auxiliary array that helps in propagating updates to avoid unnecessary updates to nodes that don't need immediate updates.
    Function updateRange
    This function updates a given range [start, end] by adding a specified value val to all elements within that range.
    Lazy Propagation:
    If there is a pending update in the lazyTree for the current node (lazyTree[i] != 0), it is applied to segTree[i].
    If the current node is not a leaf node, propagate the pending update to its children in the lazyTree.
    Reset the current node's lazy value to 0.
    Range Check:
    If the current range [l, r] is completely outside the update range [start, end], return without doing anything.
    If the current range [l, r] is completely inside the update range [start, end], update segTree[i] and propagate the update to its children in lazyTree.
    Partial Overlap:
    If there is a partial overlap, recursively call updateRange for the left and right children.
    After updating the children, update the current node's value to the sum of its children.
    Key Operations:
    ╔═╩╗╔╩╗╔═╩═╩╩╩╩╗╔═╗
    ║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
    ╠╗║╚╝║║╠╗║╚╣║║║║║═╣
    ╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
    ✹ Timelines✹
    00:00 - Introduction
    00:11 - Motivation
    01:49 - Recap of Point Update Query
    06:42 - How to do Range Update using Lazy Propagation
    36:19 - Story To Code
    #codestorywithMIK
    #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook #leetcode #computerscience #leetcodesolutions #leetcodequestionandanswers #code #learning #dsalgo #dsa #2024 #newyear #RecursionExplained #CodingJourney #Programming101 #TechTalks #AlgorithmMastery #Recursion #Programming #Algorithm #Code #ComputerScience #SoftwareDevelopment #CodingTips #RecursiveFunctions #TechExplained #ProgrammingConcepts #CodeTutorial #LearnToCode #TechEducation #DeveloperCommunity #RecursiveThinking #ProgrammingLogic #ProblemSolving #AlgorithmDesign #CSEducation
    #segmenttree #segment #rangequeries

Komentáƙe • 22

  • @Arya20012
    @Arya20012 Pƙed 16 dny +3

    Bawal Video hai bhaiya , eekdam jhakkas

  • @sakshamsharma4713
    @sakshamsharma4713 Pƙed 21 dnem +5

    This segment tree playlist is a gem

  • @banaras_wale07
    @banaras_wale07 Pƙed 21 dnem +4

    hello bhaiya,sde ke liye dsa and system design ke alawa aur kya kya padhna hota hain.

  • @wearevacationuncoverers
    @wearevacationuncoverers Pƙed 20 dny +1

    best explanation. extremely underrated.

  • @umeshbisht1054
    @umeshbisht1054 Pƙed 20 dny +1

    Thanku bhaiya ❀

  • @manasbiswas9249
    @manasbiswas9249 Pƙed 11 dny +1

    God!!🙏

  • @chitranshjain9714
    @chitranshjain9714 Pƙed 21 dnem +3

    Amazing bhaiya

  • @EB-ot8uu
    @EB-ot8uu Pƙed 20 dny

    mast. samajh me agaya.

  • @souravjoshi2293
    @souravjoshi2293 Pƙed 20 dny

    hats off bro

  • @TusharRaja3009
    @TusharRaja3009 Pƙed 20 dny +2

    Dated 7-7 and its video num 7 😅😊😂 Thanks for Such wonderful videos ❀

    • @vivekhalder2974
      @vivekhalder2974 Pƙed 20 dny +2

      achha hua aapne thala for a reason nahi bol diya đŸ€ŁđŸ€Ł. but yes, this man is actually great.

  • @manasranjanmahapatra3729
    @manasranjanmahapatra3729 Pƙed 19 dny

    Hello Could you please make video solution for 2407. Longest Increasing Subsequence II. This playlist is amazingđŸ”„

  • @user-nx9jh6uo2d
    @user-nx9jh6uo2d Pƙed 16 dny

    Sir..please jaldi videos daliye..

  • @xiaoshen194
    @xiaoshen194 Pƙed 20 dny +4

    TYSM for this!! I was stuck on the 6th ques of CSES Range section as it was based on range update. Also just a small query, can we expect Fenwick tree in this playlist?

    • @aws_handles
      @aws_handles Pƙed 20 dny

      Bangaya kya 6th ques bhai ?

    • @xiaoshen194
      @xiaoshen194 Pƙed 20 dny +1

      @@aws_handles try hi nhi kiya bhai, Aaj krunga

  • @insidious_681
    @insidious_681 Pƙed 20 dny

    sir plz contest solution bhi start krdo
    humble request of many struggling people

  • @gui-codes
    @gui-codes Pƙed 21 dnem

    i was waiting for the next video. thank you so much

  • @unknown47896
    @unknown47896 Pƙed 21 dnem

    thank you so much sir

  • @user-ub2is4rs4x
    @user-ub2is4rs4x Pƙed 21 dnem

    Thanks a lot 😍😍😍

  • @karanveersharma4643
    @karanveersharma4643 Pƙed 18 dny

    bro please solve 406 question. I am unable to understand segment tree approach.

  • @chitranshjain9714
    @chitranshjain9714 Pƙed 21 dnem

    Bhaiya today's contest question no 4 please