Given a string str containing numbers separated with “, “. The task is to convert it into an integer array and find the sum of… Read More

# Tag Archives: Traversal

Prerequisite: Insert Element Circular Doubly Linked List. Convert an Array to a Circular Doubly Linked List. Given the start pointer pointing to the start of… Read More

Given a tree of N nodes and N-1 edges. The task is to print the DFS of the subtree of a given node for multiple… Read More

Given head of a linked list of integers and an integer k, your task is to modify the linked list as follows: Consider nodes in… Read More

Given a root node to a tree, find the sum of all the leaf nodes which are at maximum depth from the root node.Example: 1… Read More

Given an N x M grid. The task is to find the minimum product of four adjacent numbers in the same direction (up, down, left,… Read More

Given a linked list, rearrange it such that converted list should be of the form a < b > c < d > e <… Read More

Given a BST and a key. The task is to find the inorder successor and predecessor of the given key. In case, if either of… Read More

Given an array A of N numbers where Ai represent the value of the (i+1)th node. Also given are M pair of edges where u… Read More

Given a Binary tree and a number N, write a program to find the N-th node in the Postorder traversal of the given Binary tree.… Read More

Given a binary tree, find the vertical width of the binary tree. The width of a binary tree is the number of vertical paths. In… Read More

Write a function to print ZigZag order traversal of a binary tree. For the below binary tree the zigzag order traversal will be 1 3… Read More

Given two arrays that represent Preorder traversals of a full binary tree and its mirror tree, we need to write a program to construct the… Read More

Construct the BST (Binary Search Tree) from its given level order traversal. Examples: Input : arr[] = {7, 4, 12, 3, 6, 8, 1, 5,… Read More

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