Print nodes of a binary tree in vertical order
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.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven 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.
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.
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.
Given a binary tree, write an efficient algorithm to invert it.
Given a maze in the form of a rectangular matrix, filled with either O, X, or M, where O represents an open cell, X represents a blocked cell, and M represents landmines in the maze, find the shortest distance of every open cell in the maze from its nearest mine.
Given a binary tree, print corner nodes of every level in it.
Given a binary tree, print all nodes for each diagonal having negative slope (\). Assume that the left and right child of a node makes a 45–degree angle with the parent.
Given a binary tree, perform vertical traversal on it. In vertical traversal, nodes of a binary tree are printed in vertical order. Assume that the left and right child makes a 45–degree angle with the parent.