Aryan PrajapatKnowledge Contributor
Define Segment Tree data structure and its applications.
Define Segment Tree data structure and its applications.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
A segment Tree is a binary tree that is used to store intervals or segments. The Segment Tree is made up of nodes that represent intervals. Segment Tree is used when there are multiple range queries on an array and changes to array elements.
Following are key operations performed on the Segment tree data structure:
Building Tree: In this step, we create the structure and initialize the segment tree variable.
Updating the Tree: In this step, we change the tree by updating the array value at a point or over an interval.
Querying Tree: This operation can be used to run a range query on the array.
Following are real-time applications for Segment Tree:
Used to efficiently list all pairs of intersecting rectangles from a list of rectangles in the plane.
The segment tree has become popular for use in pattern recognition and image processing.
Finding range sum/product, range max/min, prefix sum/product, etc
Computational geometry
Geographic information systems
Static and Dynamic RMQ (Range Minimum Query)
Storing segments in an arbitrary manner