# Monthly Archive: December 2015

## Detect start of a loop in linked list

Problem : Given a linked list, implement an algorithm which returns the node at the beginning of the loop. This post is a follow-up of – JavaScript Linked List Example – Detect a loop...

## Find loop length in a cyclic/circular linked list

Input : A linked list Output: An integer This post is a follow-up of – JavaScript Linked List Example – Detect a loop in cycliccircular linked list. I recommend reading those posts first, as...

## Detect a loop in cyclic/circular linked list

Logic : If a linked list has a cycle then no node has a null as next pointer. A simple loop exists when p1.next.next !== null as shown below. While iterating over the linked...

## Determine if a binary tree is a binary search tree

Binary tree and Binary search tree are defined as follows : Binary tree is a tree data structure in which each node has at most two child nodes. A binary search tree (BST) is...

## Implement a debounce function in javascript

Problem description : Implement a debounce function. For example, you wanted the mousmove function to be called only after 2 seconds has passed between mouse move events. A debounce function limits the rate at...

## Given the binary tree create linked lists of the nodes at the same level

Problem description : Convert a given binary tree to a linked list of all the nodes at each depth (if you have a binary tree with depth D, you’ll have D linked lists). Logic...

## Word break problem dynamic programming

Problem : Given a string and an array of words, find out if the input string can be bro­ken into a space-separated sequence of one or more words. For example, inputDict = [“I” ,...

## Introduction to backtracking

Backtracking is a general algorithmic technique that considers searching every possible combination in order to solve a problem. It is also known as depth-first search or branch and bound. It is an important tool...