srinivastechblog.hashnode.devMastering Fenwick Tree for Competitive ProgrammingWhile reading, don’t overthink or get stuck. Just follow along with the flow—you’ll understand everything step by step as we go. Given ArrayIndex : 0 1 2 3 4 5 6Array : 3 2 2d ago·11 min read
srinivastechblog.hashnode.devMo’s Algorithm – Step by Step GuideMo’s Algorithm is a technique used to answer range queries efficiently on arrays You are given : An array A Many queries: [L, R] Each query asks something like : sum of elements number of dis4d ago·10 min read
srinivastechblog.hashnode.devEfficient Range Queries Using Sqrt DecompositionSquare Root Decomposition is a technique used to answer range queries efficiently. When do we use it? When you have : An array A[0…N-1] Many queries like : Sum of range [L, R] Min/Max in range C4d ago·6 min read
srinivastechblog.hashnode.devEssential Math Algorithms for Competitive CodingBinary Exponentiation : is a fast method to calculate powers like aⁿ , without multiplying a again and again n times. Instead of O(n) multiplications, it works in O(log n) time. Idea Behind Binary Exponentiation We use two simple observations : If po...Feb 16·7 min read
srinivastechblog.hashnode.devSweep Line Technique : The Secret Weapon for Range & Geometry Problems , Part-2Sweep Line Ideas : Question :-Given N Intervals Of The Form -> L,RN<=10^5L,R <= 10^9 1 - Find Union Of All :The union of two sets contains all elements from both sets, with common elements included only once Example :Intervals : [1,5] [3,7] Numb...Feb 14·4 min read