C++ | Non - Recurisve Segment Tree
Here the major takeaway is to use Boyer Moore\'s Majority Vote algorithm in our Segment Tree to find the majority element.\nIt allows us to find the majority el
Here the major takeaway is to use Boyer Moore\'s Majority Vote algorithm in our Segment Tree to find the majority element.\nIt allows us to find the majority element in a range in O(n) time. \n\nYou can refer to the following link to know more about Boyer Moore Algorithm:\nhttps://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_majority_vote_algorithm\n\nAlso, if you want to solve a simpler version of finding the majority element, you can refer to the following question:\nhttps://leetcode.com/problems/majority-element/\n\nThere are plenty of other Segment tree solutions here. Just wanted to share my **Non - Recurisve Segment Tree** solution. : )\n\n<iframe src="https://leetcode.com/playground/AtBV6gRQ/shared" frameBorder="0" width="1000" height="1000"></iframe>
['Tree', 'C']