Archive for the ‘general_problems’ Category

Fenwick Tree (Binary Index Tree)

July 28, 2018

Fenwick Tree can be used for range query operations with support for update in O(logn) time. Both of these operations can be done in O(logn) time. Another data structure that supports the operations in O(logn) time is segment tree. However, Fenwick tree is less complex data structure. (more…)

Advertisements

8 queen problem (backtracking)

July 5, 2018

Backtracking problems tries to create a solution tree, once previous instances pass. If condition fails at some point, it backtracks to the previous instance where it was successful, and try other possible options.

(more…)

Create all possible combinations

September 24, 2017

This was an attempt to solve SPOJ – SQRBR, but gives TLE. It explores all the options recursively, and without the use of dynamic programming. This technique can be used to generate all the combination of certain values.  (more…)