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
Given root of binary search tree and K as input, find K-th smallest element in BST.
For example, in the following BST, if k = 3, then output should be 10, and if k =...
Share
Given preorder traversal of a binary search tree, construct the BST.
For example, if the given traversal is {10, 5, 1, 7, 40, 50}, then the output should be root of f...
Share
There are numerous applications we need to find floor (ceil) value of a key in a binary search tree or sorted array. For example, consider designing memory manag...
Share
Given a Binary Search Tree (BST), convert it to a Binary Tree such that every key of the original BST is changed to key plus sum of all greater keys in BST.
Example...
Share
In C++, std::substr() is a predefined function used for string handling. string.h is the header file required for string functions.
This function takes two values po...
Share
Data abstraction is one of the most essential and important feature of object oriented programming in C++. Abstraction means displaying only essential information an...
Share
Sometimes implementation of all function cannot be provided in a base class because we don’t know the implementation. Such a class is called abstract class. ...
Share
Given a string, find the longest substring which is palindrome. For example, if the given string is “forgeeksskeegfor”, the output should be “g...
Share
Given two strings ‘X’ and ‘Y’, find the length of the longest common substring.
Examples :
Input : X = “GeeksforGeeks”, ...
Share