thepranaygupta / Data-Structures-and-Algorithms

A repository that contains all the Data Structures and Algorithms concepts and their implementation in several ways, programming questions and Interview questions. The main aim of this repository is to help students who are learning Data Structures and Algorithms or preparing for an interview.
https://thepranaygupta.github.io/Data-Structures-and-Algorithms/
GNU General Public License v3.0
1.07k stars 383 forks source link

Add segment tree implementation in Python #604

Closed pardhusnc2004 closed 1 month ago

pardhusnc2004 commented 1 month ago

**PR Checklist:

What kind of change does this PR introduce? (check at least one)

Briefly describe the changes in this PR

Added a segment tree algorithm in Python for efficient range query and update operations. This implementation supports both building the segment tree in O(n) time and performing queries and updates in O(log n) time. The segment tree is implemented using an array-based approach with recursion for queries and updates.

Other information:

Soon, I will be adding the implementations of all types of Segment Tree.