Загрузка страницы

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
Показать
Комментарии отсутствуют
Введите заголовок:

Введите адрес ссылки:

Введите адрес видео с YouTube:

Зарегистрируйтесь или войдите с
Информация о видео
24 июля 2015 г. 4:29:19
00:13:52
Яндекс.Метрика