Efficiently print all nodes between two given levels in a binary tree
Given a binary tree, efficiently print all nodes between two given levels in a binary tree. The nodes for any level should be printed from left to right.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a binary tree, efficiently print all nodes between two given levels in a binary tree. The nodes for any level should be printed from left to right.
Given a directed graph and two vertices (say source and destination vertex), determine if the destination vertex is reachable from the source vertex or not. If a path exists from the source vertex to the destination vertex, print it.
Given a binary tree, print its nodes in vertical order. Assume that the left and right child of a node makes a 45–degree angle with the parent.
This post will implement a queue using the stack data structure. In other words, design a queue that supports enqueue and dequeue operations using standard push and pop operations of the stack.
Given a multilevel linked list, convert it into a singly linked list so that all nodes of the first level appear first, followed by all nodes of the second level, and so on.
Given a weighted digraph (directed graph), find the least-cost path from a given source to a given destination with exactly m edges.
Given a weighted graph, find the maximum cost path from a given source to a destination that is greater than a given integer k. The path should not contain any cycles.
This article covers queue implementation in Python. A queue is a linear data structure that follows the FIFO (First–In, First–Out) order, i.e., the item inserted first will be the first one out.
Given a binary tree, write an efficient algorithm to print its right view. For example, the right view of a given binary tree is 1, 3, 6, 8.
This post will discuss how to traverse the given directory and list out all files present in it and all its sub-directories using BFS and DFS.
Given a binary tree, write an efficient algorithm to compute the maximum number of nodes in any level in the binary tree.
Consider a directed graph where the weight of its edges can be one of x, 2x, or 3x (x is a given integer), compute the least-cost path from source to destination efficiently.