Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

Linked List in Binary Tree (BFS + DFS + Preorder Traversal)

Автор: AlgosWithMichael

Загружено: 2021-01-02

Просмотров: 8038

Описание:

Check out my interview prep platform for learning the patterns!
📢 Interview Prep Platform: https://algoswithmichael.com

🎧 Join the community Discord:   / discord  
💰 Support me on Patreon:   / michaelmuinos  
🔗Follow me on LinkedIn:   / michael-muinos  
📂Follow me on Github: https://github.com/MichaelMuinos

In this video, I go over the LeetCode problem "Linked List in Binary Tree". We are given a binary tree and linked list and must determine if the linked list is found in a downward direction inside of the binary tree. This problem can be solved in a couple different ways including depth-first search, breadth-first search, preorder traversal, and dynamic programming. Using a depth-first search is critical because we need to check to see if the head of our linked list is anywhere in our tree, if it is, we can choose to use a breadth-first search or a depth-first search to search for the rest of the nodes.

In each recursive call, we return true or false where the value determines if we have found our path or not. If we return true from our root recursive call, that means we successfully found the linked list somewhere in our binary tree. The time complexity of the solutions are O(N * min(L, H)) where N is the number of nodes we have in our tree, L is the length of our linked list, and H is the depth of the tree. The space complexity is going to be O(H) where H is the depth of our tree as well.

Linked List in Binary Tree (BFS + DFS + Preorder Traversal)

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

Microsoft Coding Interview Question - Rotate List (LeetCode)

Microsoft Coding Interview Question - Rotate List (LeetCode)

Longest Increasing Path in a Matrix (DFS + Memoization)

Longest Increasing Path in a Matrix (DFS + Memoization)

Преобразование двоичного дерева в связанный список — Leetcode 114 — Python

Преобразование двоичного дерева в связанный список — Leetcode 114 — Python

Binary Tree Maximum Path Sum (Animated Walkthrough) (LeetCode)

Binary Tree Maximum Path Sum (Animated Walkthrough) (LeetCode)

Я плохо разбирался в структурах данных и алгоритмах. И вот что я сделал.

Я плохо разбирался в структурах данных и алгоритмах. И вот что я сделал.

Простейший трюк обхода двоичного дерева для прямого порядка, прямого порядка и обратного порядка

Простейший трюк обхода двоичного дерева для прямого порядка, прямого порядка и обратного порядка

Как взломать любое программное обеспечение

Как взломать любое программное обеспечение

Flatten Binary Tree to Linked List | 3 Methods Explained | Trees

Flatten Binary Tree to Linked List | 3 Methods Explained | Trees

Понимание B-деревьев: структура данных, лежащая в основе современных баз данных

Понимание B-деревьев: структура данных, лежащая в основе современных баз данных

После Купянска Путину не верят даже свои. Руслан Левиев

После Купянска Путину не верят даже свои. Руслан Левиев

К чему готовиться? Останемся без денег? Что делать, когда заблокируют всё? || Дмитрий Потапенко*

К чему готовиться? Останемся без денег? Что делать, когда заблокируют всё? || Дмитрий Потапенко*

Merge K Sorted Lists - Divide and Conquer Approach

Merge K Sorted Lists - Divide and Conquer Approach

Binary Tree Algorithms for Technical Interviews - Full Course

Binary Tree Algorithms for Technical Interviews - Full Course

Как реализовать дерево на языке C

Как реализовать дерево на языке C

Construct Binary Tree from Inorder and Preorder Traversal - Leetcode 105 - Python

Construct Binary Tree from Inorder and Preorder Traversal - Leetcode 105 - Python

Алгоритмы и структуры данных за 15 минут! Вместо 4 лет универа

Алгоритмы и структуры данных за 15 минут! Вместо 4 лет универа

L38. Flatten a Binary Tree to Linked List | 3 Approaches | C++ | Java

L38. Flatten a Binary Tree to Linked List | 3 Approaches | C++ | Java

Они унизили уборщика — и поплатились за это | Розыгрыш в спортзале от Анатолия № 57

Они унизили уборщика — и поплатились за это | Розыгрыш в спортзале от Анатолия № 57

Recursive PreOrder traversal of a Binary Tree in Java

Recursive PreOrder traversal of a Binary Tree in Java

Объяснение решения симметричного обхода двоичного дерева LeetCode — Java

Объяснение решения симметричного обхода двоичного дерева LeetCode — Java

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]