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

Diameter of a Binary Tree | Trees

In this video, I have discussed how to calculate diameter of a binary tree with O(n) time complexity and O(1) space complexity.
The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root.

Source code: https://github.com/fit-coder/fitcoderyoutube/tree/master/tree

00:00 Introduction
00:06 Definition of Diameter
01:48 Pseudo Code
10:01 C++ Implementation

-------------------------------------------------------------
I live in New Delhi and love explaining programming concepts. I have done M.Tech(BITS Pilani) + B.Tech(PEC, Chandigarh) in Computer Science and am currently working as a software engineer in a MNC.
If you like my content, please like, share my videos and subscribe to the channel.
-------------------------------------------------------------

For other tree tutorials, please refer to the below links:
Introduction to Trees: https://youtu.be/sAtplKUhtQ8
Binary Trees: https://youtu.be/2edIhwsnqBY&t=8s
Binary Tree Traversals: https://youtu.be/p3YUlEZr2vM&t=64s
Shortcut trick for Binary Tree Traversals: https://youtu.be/Y-FcfdAWd8Q
Inorder Traversal Iterative: https://youtu.be/_4Jhejxvttc
Preorder Traversal Iterative: https://youtu.be/RDG4jtLGDmo
Postorder Traversal Iterative (2 stack method): https://youtu.be/4VpO4lrRINc
Postorder Traversal Iterative (1 stack method): https://youtu.be/Zv14sK2kvtQ
Level Order Traversal: https://youtu.be/lXIk1PXb1Jc
Morris Inorder Traversal: https://youtu.be/BuI-EULsz0Y
Zigzag Level Order Traversal: https://youtu.be/YwABW6q3DOM
Binary Tree From Inorder and Preorder (Recursive): https://youtu.be/FBaSrNSf9po
Binary Tree From Inorder and Preorder (Iterative): https://youtu.be/LVFYyw7rZb8
Binary Tree From Inorder and Postorder (Recursive):https://youtu.be/rY9ejIY9Osw
Binary Tree From Inorder and Postorder (Iterative):https://youtu.be/8cUuA066lZQ
Binary Tree From Inorder and Levelorder: https://youtu.be/7eBndROfUnw
Binary Tree From Preorder and Postorder: https://youtu.be/LnHSOy7ctms
Height of a Binary Tree (Recursive): https://youtu.be/9ejFkjEgK3k
Height of a Binary Tree (Iterative): https://youtu.be/OUhTI4dtQbY&t=385s
Diameter of a Binary Tree: https://youtu.be/Prph-j0sgr4
Lowest Common Ancestor: https://youtu.be/k7NF6rNOs4Y
Left View and Right View (Recursive): https://youtu.be/3Qjm1iX5dw8
Left View and Right View (Iterative): https://youtu.be/ruT7rVIveqA
Top View and Bottom View (Recursive): https://youtu.be/zoagmWU1yD8
Top View and Bottom View (Iterative): https://youtu.be/=-Cr4I8ZTXgc
Boundary Traversal: https://youtu.be/0nx-t0PcccA

For in-depth Graph theory and implementation details, please refer to the below playlist:
https://youtu.be/4xMsNIPEkwA&list=PLFj4kIJmwGu3m30HfYDDufr3PZBfyngr0

#DataStructure,#Trees,#FitCoder,#Algorithm,#competitiveprogramming,#binarytree

Видео Diameter of a Binary Tree | Trees канала Fit Coder
Показать
Комментарии отсутствуют
Введите заголовок:

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

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

Зарегистрируйтесь или войдите с
Информация о видео
7 февраля 2021 г. 14:51:46
00:11:19
Яндекс.Метрика