## Sum of nodes on the longest path from root to leaf node

Given a binary tree containing n nodes. The problem is to find the sum of all nodes on the longest path from root to leaf… Read More »

Quick Links for Tree

Quizzes |

Given a binary tree containing n nodes. The problem is to find the sum of all nodes on the longest path from root to leaf… Read More »

Given a binary tree in which nodes are numbered from 1 to n. Given a node and a positive integer K. We have to print… Read More »

Given a generic tree, perform a Level order traversal and print all of its nodes Input : 10 / / \ \ 2 34 56… Read More »

Given a binary tree containing n nodes. The problem is to find the sum of all the parent node’s which have a child node with… Read More »

A tree consisting of n nodes is given, we need to print its DFS. Examples : Input : Edges of graph 1 2 1 3… Read More »

Given a set of words represented in a ternary search tree, find the length of largest word among them. Examples: Input : {“Prakriti”, “Raghav”, “Rashi”,… Read More »

Given a binary tree, print nodes of odd level in any order. Root is considered at level 1. For example consider the following tree 1… Read More »

The diameter of a tree is the number of nodes on the longest path between two leaves in the tree. The diagram below shows two… Read More »

In this article, we would be implementing the Binary Search Tree data structure in Javascript. A tree is a a collection of node connected by… Read More »

Given a binary tree, delete a node from it by making sure that tree shrinks from the bottom (the deleted not is replaced by bottommost… Read More »

Consider a binary tree whose nodes have ids from 1 to n where n is number of nodes in the tree. The tree is given… Read More »

Given a parent array P, where P[i] indicates the parent of ith node in the tree(assume parent of root node id indicated with -1). Find… Read More »

Given a binary tree and a key, insert the key into the binary tree at first position available in level order. Recommended: Please try your… Read More »

Given an array which contains the preorder traversal of full k-ary tree, construct the full k-ary tree and print its postorder traversal. A full k-ary… Read More »

Given a binary tree, find the sum of all the leaf nodes. Examples: Input : 1 / \ 2 3 / \ / \ 4… Read More »