Given a directed graph, check whether the graph contains a cycle or not. Your function should return true if the given graph contains at least… Read More
Tag Archives: Oracle
We have discussed AVL insertion in the previous post. In this post, we will follow a similar approach for deletion. Steps to follow for… Read More
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… Read More
Write a function to connect all the adjacent nodes at the same level in a binary tree. Structure of the given Binary Tree node is… Read More
Write a function to connect all the adjacent nodes at the same level in a binary tree. Structure of the given Binary Tree node is… Read More
Given a 2D array, print it in spiral form. See the following examples. Examples: Input: {{1, 2, 3, 4}, … Read More
Write a function detectAndRemoveLoop() that checks whether a given Linked List contains loop and if loop is present then removes the loop and returns true.… Read More
Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may… Read More
Given a text txt[0..n-1] and a pattern pat[0..m-1], write a function search(char pat[], char txt[]) that prints all occurrences of pat[] in txt[]. You may… Read More
Given an n x n matrix and a number x, find the position of x in the matrix if it is present in it. Otherwise,… Read More
Given an expression string exp, write a program to examine whether the pairs and the orders of “{“, “}”, “(“, “)”, “[“, “]” are… Read More
Given a binary tree and a number, return true if the tree has a root-to-leaf path such that adding up all the values along the… Read More
The diameter of a tree (sometimes called the width) is the number of nodes on the longest path between two end nodes. The diagram below… Read More