
Print all anagrams of a given string.

Convert a number from one base to another: C Code

Program to print the size of a file (in bytes) and its contents in binary format: C Code

Print the matrix in spiral order.

Program to create an SLR (Simple LR) Parse table (state machine) from a CFG (Context Free Grammar):
C++ Code (2011)

Computer Graphics Algorithms (C++, OpenGL & GLUT):

Binary tree reconstruction:
 When inorder & preorder are given: C++ code
 When inorder & postorder are given: C++ code

Adaptive A* Algorithm.

Program to find the square root of a number by repeated division technique (not very efficient; divide and conquer technique): C++ Code

Program to do parenthesis matching (using Stack & Tokenizer template classes): C++ Code

Given string of digits like "72388" and int n, delete n characters from the string such that the resulting string contains minimal number representation; you must preserve relative position of digits. Example: if s="72388" and n=2, the answer is 238.

Doubly linked list with Iterators: C++ code

Merge two sorted linked lists: C++ code

AVL Tree Implementation.

RedBlack Tree Implementation.

Static and Dynamic Huffman Encoding.

Dynamic LZW Encoding.

Hadoop Java Code to process a Chess Dataset (from FICS Games Database in PGN format). It was executed on Amazon EMR. Provisioning of the Hadoop cluster, running/terminating jobs and handling data transfer between EC2(VM) and S3(Object Storage) are automated by Elastic MapReduce.

Handwritten Digit Recognition using Naive Bayesian classifer.

Longest Increasing Subsequence (O(N log N) algorithm)

Pancake Sorting Algorithm

Kahn's Algorithm for Topological Sorting

Kosaraju's Algorithm for finding Strongly Connected Components in a directed graph

Convert a binary tree to circular doubly linked list: C++ Code
Pacman Game: Developed a PacMan game that plays by itself using the minimax algorithm. The utility function uses A* search & kmeans clustering (among other things). It supports multiple PacMan and ghost agents. It has a 'wormhole' feature that transports pacman agents to different locations on the board to avoid capture by the ghosts. The utility function starts using kmeans clustering only when there are no dots nearby the Pacman agent. The 'k' value is calculated as sqrt(n/2) which seems to work well. (C++, OpenGL, GLUT)

Convert a sorted linked list to a balanced BST (Binary Search Tree): C++ Code

Given a 2D array of 0s and 1s, find a plus (+) pattern of maximum size:

Trie data structure (insert & search operations):

Check whether a given tree is BST (Binary Search Tree) or not: C++ Code

Reverse a singly linked list in groups of a given size. For example1: Input: 1>2>3>4>5>6>7>8>NULL, size = 3, Output: 3>2>1>6>5>4>8>7>NULL. Example2: Input: 1>2>3>4>5>NULL, size = 4, Output: 4>3>2>1>5>NULL. If size = 1, no reversal happens and the list output will be the same as input: C++ code

LRU Page Replacement scheme (using counters):

Search for an element in a rotated and sorted array: an element in a sorted array can be found in O(log n) via binary search. But suppose we rotate a sorted array 'd' times (the value of 'd' unknown to you), how do we search for an element in O(log n) time? Assume that all the elements of the array are distinct: C++ Code

Given a sorted array and a number x, write a function that counts the occurrences of x. Expected time complexity is O(log n): C++ Code

Given a list of arrays, return a list of arrays, where each array is a combination of one element in each given array. Suppose the input is [[1, 2, 3], [4], [5, 6]], the output should be [[1, 4, 5], [1, 4, 6], [2, 4, 5], [2, 4, 6], [3, 4, 5], [3, 4, 6]]: C++ Code

Longest Palindromic substring (expected time complexity is O(n^2) & space complexity is O(1)): C++ Code

Combination sum  given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. For example, C = [2, 3, 6, 7] & T = 7, the solution set is [2, 2, 3], [7]: C++ Code

Add numbers represented as linked lists (with the most significant digit at the head; for example, 123 would be 1>2>3): C++ Code

Add numbers represented as linked lists (with the least significant digit at the head; for example, 123 would be 3>2>1): C++ Code

Find Longest Common Subsequece (LCS) of two given strings (Time Complexity O(mn), Space Complexity O(mn)): C++ Code

Dijkstra's shortest Path Algorithm (using set and map containers):

Multiply large numbers are strings (for example, "1234" * "23" = "28382"): C++ Code

Given the preorder traversal of a Binary Search Tree (BST), reconstruct the tree. Expected complexity O(n):

Serialize (store it in a file so that it can be later restored) and deserialize a generic binary tree: C++ Code
link="#000000" vlink="#000000" alink="#000000"