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....
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 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...
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...
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...
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...
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...
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...
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...
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...
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...