Range Minimum Query | Segment Tree Concepts & Qns | Video 6 | codestorywithMIK

Subscribers:
101,000
Published on ● Video Link: https://www.youtube.com/watch?v=qU4DAnv3o7g



Duration: 14:24
2,112 views
90


iPad PDF Notes - https://github.com/MAZHARMIK/Intervie...
Whatsapp Community Link : https://www.whatsapp.com/channel/0029...
This is the 6th video of our playlist "Segment Tree Concepts & Questions". Find the Details below :

Video Name : Range Minimum Query | Segment Tree Concepts & Qns | Video 6 | codestorywithMIK
Video # : 6

🔍 Unraveling Segment Tree : A Journey into the Depths of it.

🎥 Welcome to the 6th 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 Minimum Query | Segment Tree Concepts & Qns | Video 6 | codestorywithMIK

🔍 What's Inside ?

🔗 We will see how we can use Segment Tree concepts to easily solve this problem - Range Minimum Query

👩‍💻 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 Minimum Query | Segment Tree Concepts & Qns | Video 6 | codestorywithMIK
Company Tags : META (slight variation)
My solutions on Github(C++ & JAVA) : https://github.com/MAZHARMIK/Intervie...
Leetcode Link : https://practice.geeksforgeeks.org/pr...


My DP Concepts Playlist :    • Roadmap for DP | How to Start DP ? | ...  
My Graph Concepts Playlist :    • Graph Concepts & Qns - 1 : Graph will...  
My Recursion Concepts Playlist :    • Introduction | Recursion Concepts And...  
My GitHub Repo for interview preparation : https://github.com/MAZHARMIK/Intervie...
Subscribe to my channel :    / @codestorywithmik  
Instagram :   / codestorywithmik  
Facebook :   / 100090524295846  
Twitter :   / cswithmik  


Summary :
buildSegmentTree function: This function recursively builds the segment tree. It starts with an initial call to buildSegmentTree(0, 0, n-1, segmentTree, arr), where i is the index in the segment tree, l and r represent the range of the current segment, segmentTree is the array representing the segment tree, and arr is the original array. At each step:

If l equals r (indicating a leaf node), the segment tree node segmentTree[i] is assigned the value of arr[l].
Otherwise, it calculates the midpoint mid and recursively builds the left and right child nodes of the segment tree.
constructST function: This function initializes the segment tree array and calls buildSegmentTree to construct the segment tree from the given array arr of size n. It returns the constructed segment tree.

querySegmentTree function: This function queries the segment tree to find the minimum value in the specified range [start, end]. It uses a recursive approach:

If the current segment [l, r] does not overlap with [start, end], it returns INT_MAX (a large integer).
If the current segment [l, r] is completely within [start, end], it returns the value stored in the segment tree node segmentTree[i].
Otherwise, it recursively queries both left and right children of the current node to find the minimum value in the specified range.
RMQ function: This function serves as an interface to query the segment tree for the range minimum query (RMQ). It takes the segment tree st, array size n, and range [a, b], and internally calls querySegmentTree to retrieve the minimum element in the range [a, b].

╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝

✨ Timelines✨
00:00 - Introduction
00:08 - Motivation
00:52 - Problem Explanation
02:03 - How to Solve using Segment Tree
07:40 - Coding it up

#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




Other Videos By codestorywithMIK


2024-07-08Crawler Log Folder | 2 Approaches | Dry Runs | Leetcode 1598 | codestorywithMIK
2024-07-07Average Waiting Time | Simple Simulation | Leetcode 1701 | codestorywithMIK
2024-07-06Range Update Query | Lazy Propagation | Segment Tree Concepts & Qns | Video 7 | codestorywithMIK
2024-07-06Find the Winner of the Circular Game | 3 Approaches | Leetcode 1823 | codestorywithMIK
2024-07-05Pass the Pillow | 2 Approaches | Easy Explanations | Leetcode 2582 | codestorywithMIK
2024-07-05Water Bottles | 3 Approaches | Easy Explanations | Leetcode 1518 | codestorywithMIK
2024-07-02Minimum Difference Between Largest and Smallest Value in Three Moves | 2 Approaches | Leetcode 1509
2024-07-02Merge Nodes in Between Zeros | 2 Approaches | Leap Of Faith | Leetcode 2181 | codestorywithMIK
2024-06-30Intersection of Two Arrays II | 2 Approaches | Easy Explanations | Leetcode 350 | codestorywithMIK
2024-06-29Longest Palindromic Subsequence | Using Blue Print | DP On Strings | Leetcode 516 | DP Concepts - 25
2024-06-28Range Minimum Query | Segment Tree Concepts & Qns | Video 6 | codestorywithMIK
2024-06-27All Ancestors of a Node in a Directed Acyclic Graph | 3 Approaches | Leetcode 2192 |codestorywithMIK
2024-06-26Maximum Total Importance of Roads | Thought Process | Leetcode 2285 | codestorywithMIK
2024-06-25Find Center of Star Graph | 2 Simple Approaches | Leetcode 1791 | codestorywithMIK
2024-06-24Balance a Binary Search Tree | Simple Explanation | Leetcode 1382 | codestorywithMIK
2024-06-23Binary Search Tree to Greater Sum Tree | Brute | Better | Optimal | Leetcode 1038 | codestorywithMIK
2024-06-23Minimum Number of K Consecutive Bit Flips | 3 Approaches | Detailed | Leetcode 995 | 3191
2024-06-22Segment Tree | Why size is 4*n | With Proof | Video 4
2024-06-21Count Number of Nice Subarrays | 2 Approaches | Similar Concept | Leetcode 1248 | codestorywithMIK
2024-06-21Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | Leetcode 1438 |Detailed
2024-06-19Grumpy Bookstore Owner | Simplest Thought Process | Leetcode 1052 | codestorywithMIK