Miscellaneous

## Two Dimensional Binary Indexed Tree or Fenwick Tree

Prerequisite – Fenwick Tree We know that to answer range sum queries on a 1-D array efficiently, binary indexed tree (or Fenwick Tree) is the… Read More »

## Counting Triangles in a Rectangular space using BIT

Pre-requisite : BIT(Binary Indexed Tree or Fenwick Tree), 2D BIT Given a 2D plane, respond to Q queries, each of the following type: Insert x… Read More »

## How to write Regular Expressions?

A regular expression (sometimes called a rational expression) is a sequence of characters that define a search pattern, mainly for use in pattern matching with… Read More »

## How to read content of GeeksforGeeks in an organized way?

We have been trying to organize content of geeksforgeeks. We added below pages for this purpose. C C++ Java Python Algorithms Interview Corner GATE Corner… Read More »

## Match a pattern and String without using regular expressions

Given a string, find out if string follows a given pattern or not without using any regular expressions. Examples: Input: string – GraphTreesGraph pattern -… Read More »

Given an empty set initially and a number of queries on it, each possibly of the following types: Insert – Insert a new element ‘x’.… Read More »

## Minimax Algorithm in Game Theory | Set 3 (Tic-Tac-Toe AI – Finding optimal move)

Prerequisites: Minimax Algorithm in Game Theory, Evaluation Function in Game Theory Let us combine what we have learnt so far about minimax and evaluation function… Read More »

## Find last unique URL from long list of URLs in single traversal

Given a very long list of URLs, find out last unique URL. Only one traversal of all URLs is allowed. My Personal Notes arrow_drop_up Save

## Find Maximum number possible by doing at-most K swaps

Given a positive integer, find maximum integer possible by doing at-most K swap operations on its digits. Examples: Input: M = 254, K = 1… Read More »

## Find paths from corner cell to middle cell in maze

Given a square maze containing positive numbers, find all paths from a corner cell (any of the extreme four corners) to the middle cell. We… Read More »

## A* Search Algorithm

Motivation To approximate the shortest path in real-life situations, like- in maps, games where there can be many hindrances. We can consider a 2D Grid… Read More »

## Number of ways to calculate a target number using only array elements

Given an integer array, find number of ways to calculate a target number using only array elements and addition or subtraction operator. Example: Input: arr[]… Read More »

## Meet in the middle

Given a set of n integers where n <= 40. Each of them is at most 1012, determine the maximum sum subset having sum less… Read More »

## GCDs of given index ranges in an array

Given an array a[0 . . . n-1]. We should be able to efficiently find the GCD from index qs (query start) to qe (query… Read More »

## Cyclic Redundancy Check and Modulo-2 Division

CRC or Cyclic Redundancy Check is a method of detecting accidental changes/errors in communication channel. CRC uses Generator Polynomial which is available on both sender… Read More »