Print edge nodes (boundary nodes) of a Binary Tree

Given a Binary Tree. Write code to print the boundary nodes of the Tree. For example, if the Binary tree is __30__ / \ / […]

Print character occurring maximum number of times in a string

Write a function which will print the character coming maximum number of times in a given String. For example: Input String: ritambhara Output: a Because […]

Longest substring of unique characters

Given a String in which characters may be repeating. Find the length of longest substring of where all characters are unique (non-repeating). For Example: If […]

Remove duplicates from a linked list

Given a linked list, write code to remove duplicates from the list. Input : 1->3->4->4->6->6->6->7 Output: 1->3->4->6->7 Input : 4->1->4->4 Output: 4->1

Merging two Linked List

Given two linked list with Node values sorted in ascending order. Write function that accepts these two linked lists, merge them and return pointer to […]

Find number occurring odd number of times in an array

Given an array of positive integers in which each number is repeated even number of times, except one which is repeated odd number of times. […]

Print all nodes at distance k from root of a Binary Tree

Given a Binary Tree and a positive integer ‘k’, write code which will print all the nodes which are at distance ‘k’ from the root. […]

Check if a Binary Tree is Binary Search Tree

Given a Binary Tree, write code to check if it is Binary Search Tree or not ? Binary search tree is a binary tree with […]

Convert a Binary Tree to Binary Search Tree

Given a Binary Tree, write code to convert it to Binary Search Tree such that the structure of the tree remains the same. For example: […]

Lowest Common Ancestor in Binary Search Tree

In a Binary Search Tree, you are given the values of two nodes. Write a code which will return the Lowest Common Ancestor of both […]