An Eulerian trail (or Eulerian path) is a path in a graph that visits every edge exactly once. Given a directed graph, check whether it has an Eulerian path or not.
Given a list of non-negative integers, find the minimum number of merge operations to make it a palindrome. A merge operation can only be performed on two adjacent elements. The result of a merge operation is that the two adjacent elements are replaced with their sum.
Given a linked list, construct a complete binary tree from it. Assume that the order of elements present in the linked list is the same as that in the complete tree’s array representation.
Given a list of database transactions, find all read-write conflicts among them. Assume that there is no strict two-phase locking (Strict 2PL) protocol to prevent read-write conflicts.
Given a binary tree, check if removing an edge can split it into two binary trees of equal size.
Given two height-balanced binary search trees, in-place merge them into a single balanced binary search tree. For each node of a height-balanced tree, the difference between its left and right subtree height is at most 1.
Given an array representing the parent-child relationship in a binary tree, find the tree’s height without building it. The parent-child relationship is defined by
(A[i], i) for every index
i in array
Given a binary tree and two tree pointers,
y, write an efficient algorithm to check if they lie on the same root-to-leaf path in the binary tree. In other words, determine whether
x is an ancestor of
x is a descendant of
Given an array representing the preorder traversal of a BST, determine whether it represents a skewed BST or not. In a skewed BST, each node’s descendants are either smaller or larger than the node itself.
b blue, and
g green balls, find the total number of arrangements in a row such that no two balls of the same color end up together.
Given a set of strings, print all pairs of anagrams together. Two strings,
Y, are called anagrams if we can get a string
Y by rearranging the letters of the string
X and using all the characters of the string
X exactly once.
Given an unsorted integer array, find the smallest missing positive integer in it.