Iterate over a Queue in Java
This post will discuss various methods to iterate through a queue in Java.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedThis post will discuss various methods to iterate through a queue in Java.
This post will discuss various methods to iterate over Deque in Java. A Deque is a linear collection that supports insertion & removal at both ends.
Given an expression containing numeric operands with addition and subtraction operators, evaluate it. The expression may contain sub-expressions enclosed in opening and closing braces.
Given a binary tree, where each node stores a value between 0 and 9, calculate the sum of the numbers created by the paths from root to leaf.
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 binary tree, find its minimum depth. The minimum depth is the total number of nodes along the shortest path from the root node down to the nearest leaf node.
Write an efficient algorithm to invert alternate levels of a perfect binary tree.
Given a binary search tree (BST), efficiently convert it into a min-heap. In order words, convert a binary search tree into a complete binary tree where each node has a higher value than its parent’s value.
Given a binary tree, convert it into a doubly-linked list following the spiral order.
Given an M × N matrix of integers whose each cell can contain a negative, zero, or a positive value, determine the minimum number of passes required to convert all negative values in the matrix positive.
Given a binary tree, check if it is a min-heap or not. In order words, the binary tree must be a complete binary tree where each node has a higher value than its parent’s value.
Given a connected undirected graph and a vertex in the graph, construct a directed graph such that any path in the directed graph leads to that particular vertex.