# Monthly Archive: October 2015

## Binary tree traversal

Problem description : Tree traversal (a.k.a tree search) is a form of graph traversal and refers to the process of visiting each node in a tree data structure, exactly once, in a systematic way....

## Create a binary search tree in javascript

Create a simple binary search tree data structure in javascript. Binary tree : It is a tree data structure in which each node has at most two children, which are referred to as the...

## Create a simple queue using javascript

Problem description : Create a simple queue data structure in javascript. Queue organizes data into the sequential order. It similar to the a queue of people waiting to get a bus ticket. It’s a...

## Implement a stack using javascript

Problem description : Create a stack data structure in javascript. Stack organizes data into the sequential order. It similar to the stack of books in a library or stack of dishes in the kitchen...

## Given a singly linked list find if it is palindrome

Problem description : Write a function to determine if a singly linked list is a palindrome. Input : A linked list Output : Boolean (true or false) Approach 1: Reverse and compare the linked...

## Reverse a singly linked list

Problem description : Write a function to reverse a singly linked list. Input : A linked list Output : A linked list Logic : Iterate through linked list with three-pointers previous, current, next. While...

## Partition a linked list around a value

Problem description : Write code to partition a linked list around a value val, such that all nodes less than val come before all nodes greater than or equal to val. Input : A...

## Find the kth to last element of a singly linked list

Problem description : Implement a non-recursive algorithm to find the kth to last element of a singly linked list. Input : A linked list Output : A value of a node in a linked...

## Closest pair of numbers

Problem description : Given a list of unsorted integers, find the pair of elements that have the smallest absolute difference between them? If there are multiple pairs, find them all and return them in...

## Delete a node from a linked list in javascript

Problem description : Write a method to remove a node from a linked list. Input: A linked list Output: A linked list with one less node Logic : Iterate through the list, if you...