Given a string, find the first non-repeating character in it. For example, if the input string is “GeeksforGeeks”, then output should be ‘f...
Share
There are two singly linked lists in a system. By some programming error, the end node of one of the linked list got linked to the second list, forming an inverted Y...
Share
Given a linked list of 0s, 1s and 2s, sort it.
Source: Microsoft Interview | Set 1
Recommended: Please solve it on “PRACTICE” first, before moving on t...
Share
Given a binary tree, find height of it. Height of empty tree is 0 and height of below tree is 3.
Example Tree
Recommended: Please solve it on “PRACTICE ...
Share
A binary search tree (BST) is a node based binary tree data structure which has the following properties.
• The left subtree of a node contains only nodes with...
Share
AVL tree is a self-balancing Binary Search Tree (BST) where the difference between heights of left and right subtrees cannot be more than one for all nodes.
An Examp...
Share
We have discussed AVL insertion in the previous post. In this post, we will follow a similar approach for deletion.
Steps to follow for deletion.
To make sure that t...
Share
Greedy is an algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. Greedy...
Share
We have discussed Backtracking and Knight’s tour problem in Set 1. Let us discuss Rat in a Maze as another example problem that can be solved using Backtracki...
Share
Given two integers x and n, write a function to compute xn. We may assume that x and n are small and overflow doesn’t happen.
Examples :
Input : x = 2, n = ...
Share