Calculate the height of a binary tree – Iterative and Recursive
Write an efficient algorithm to compute the binary tree’s height. The height or depth is the total number of edges or nodes on the longest path from the root node to the leaf node.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedWrite an efficient algorithm to compute the binary tree’s height. The height or depth is the total number of edges or nodes on the longest path from the root node to the leaf node.
Given a positive number n, efficiently generate binary numbers between 1 and n using the queue data structure in linear time.
Given an N × N matrix of positive integers, find the shortest path from the first cell of the matrix to its last cell that satisfies given constraints.
Given a binary matrix where 0 represents water and 1 represents land, and connected ones form an island, count the total islands.
Flood fill (also known as seed fill) is an algorithm that determines the area connected to a given node in a multi-dimensional array.
Given a rectangular field with few sensors present, cross it by taking the shortest safe route without activating the sensors.
Given a maze in the form of the binary rectangular matrix, find the shortest path’s length in a maze from a given source to a given destination.
This article covers queue implementation in Java. A queue is a linear data structure which follows the FIFO (first-in first-out) principle. That means the object which is inserted first will be the first one out, followed by the object which was inserted next.
This article will provide C++ implementation of a queue data structure using templates in C++. This article will make the class code generic by using C++ templates to support all data types.
This article covers queue implementation in C++. A queue is a linear data structure that serves as a container of objects that are inserted and removed according to the FIFO (First–In, First–Out) principle.
This article covers queue implementation using a linked list. A queue is a linear data structure that serves as a collection of elements, with three main operations: enqueue, dequeue and peek.
This article covers circular queue implementation in C. A queue is a linear data structure that serves as a collection of elements, with three main operations: Enqueue, Dequeue, and Peek.