Programming Interview Question: How to print all diagonal's sums for a given binary tree?
'N' lines drawn at slope -1 and cutting through a left branches of a binary tree divide the binary tree into 'N+1' partitions called diagonals.
How can you print sum of nodes in a partition for all partitions?
For example, If a tree has '1' as its root '2' as its left child and '3' as its right child then there are two diagonals in it. #1 diagonal consisting of nodes '1' and '3' and #2 diagonal consisting a node '2'. Output should be - sum for diagonal 0 : 4 and sum for diagonal 1 : 2
Website: http://www.ideserve.co.in
Facebook: https://www.facebook.com/IDeserve.co.in
Видео Programming Interview Question: How to print all diagonal's sums for a given binary tree? канала IDeserve
How can you print sum of nodes in a partition for all partitions?
For example, If a tree has '1' as its root '2' as its left child and '3' as its right child then there are two diagonals in it. #1 diagonal consisting of nodes '1' and '3' and #2 diagonal consisting a node '2'. Output should be - sum for diagonal 0 : 4 and sum for diagonal 1 : 2
Website: http://www.ideserve.co.in
Facebook: https://www.facebook.com/IDeserve.co.in
Видео Programming Interview Question: How to print all diagonal's sums for a given binary tree? канала IDeserve
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
Level Order TraversalReverse a Linked List - IterativeProgramming Interview Question: Searching a 2D Sorted MatrixImplement a fair coin given an unfair coinBuying and selling stocksBinary SearchMinimum length subarray of an unsorted array sorting which results in complete sorted arrayFind an element in a sorted rotated array without finding pivot (minimum element)Maximum size square sub-matrix with all 1sBuilding Bridges Dynamic ProgrammingLeaders in an arrayFind intersection of two Linked Lists - O(A + B) Time Complexity and O(1) Space ComplexityCreate a balanced Binary Search Tree (BST) from a sorted arrayNext greater element in an arraySpiral level order traversal of a binary treeProgramming Interview Question: Recover Binary Search TreeDetect a loop in a linked listProgramming Interview Question: Find intersection of two Linked ListsFind an element in a sorted rotated arrayDemo of IDeserve web platform www.ideserve.co.in