All Nodes Distance K In A Binary Tree - Performing Bidirectional Search On A Tree Using A Hashtable
Free 5-Day Mini-Course: https://backtobackswe.com
Try Our Full Platform: https://backtobackswe.com/pricing
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions
Subscribe To Live Tech Offers: https://offerfeed.io
Join Our Coaching Service: https://backtobackswe.com/coaching
Question: You are given 3 things. The root of a binary tree, a single start node in the binary tree, and a number k. Return all nodes that are k "hops" away from the start node in the binary tree. Return a list of the values held at those nodes.
Complexities
n = total amount of nodes in the binary tree
m = total edges
Time: O( n + m )
This is standard to Breadth First Search. We upper bound the time by the number of nodes we can visit and edges we can traverse (at maximum).
Space: O( n )
We have a hashtable upper bounded by n mappings, a mapping to each node's parent.
++++++++++++++++++++++++++++++++++++++++++++++++++
HackerRank: https://www.youtube.com/channel/UCOf7UPMHBjAavgD0Qw5q5ww
Tuschar Roy: https://www.youtube.com/user/tusharroy2525
GeeksForGeeks: https://www.youtube.com/channel/UC0RhatS1pyxInC00YKjjBqQ
Jarvis Johnson: https://www.youtube.com/user/VSympathyV
Success In Tech: https://www.youtube.com/channel/UC-vYrOAmtrx9sBzJAf3x_xw
Видео All Nodes Distance K In A Binary Tree - Performing Bidirectional Search On A Tree Using A Hashtable канала Back To Back SWE
Try Our Full Platform: https://backtobackswe.com/pricing
📹 Intuitive Video Explanations
🏃 Run Code As You Learn
💾 Save Progress
❓New Unseen Questions
🔎 Get All Solutions
Subscribe To Live Tech Offers: https://offerfeed.io
Join Our Coaching Service: https://backtobackswe.com/coaching
Question: You are given 3 things. The root of a binary tree, a single start node in the binary tree, and a number k. Return all nodes that are k "hops" away from the start node in the binary tree. Return a list of the values held at those nodes.
Complexities
n = total amount of nodes in the binary tree
m = total edges
Time: O( n + m )
This is standard to Breadth First Search. We upper bound the time by the number of nodes we can visit and edges we can traverse (at maximum).
Space: O( n )
We have a hashtable upper bounded by n mappings, a mapping to each node's parent.
++++++++++++++++++++++++++++++++++++++++++++++++++
HackerRank: https://www.youtube.com/channel/UCOf7UPMHBjAavgD0Qw5q5ww
Tuschar Roy: https://www.youtube.com/user/tusharroy2525
GeeksForGeeks: https://www.youtube.com/channel/UC0RhatS1pyxInC00YKjjBqQ
Jarvis Johnson: https://www.youtube.com/user/VSympathyV
Success In Tech: https://www.youtube.com/channel/UC-vYrOAmtrx9sBzJAf3x_xw
Видео All Nodes Distance K In A Binary Tree - Performing Bidirectional Search On A Tree Using A Hashtable канала Back To Back SWE
Показать
Комментарии отсутствуют
Информация о видео
Другие видео канала
L30. Print all the Nodes at a distance of K in Binary Tree | C++ | JavaMax Contiguous Subarray Sum - Cubic Time To Kadane's Algorithm ("Maximum Subarray" on LeetCode)Knuth–Morris–Pratt (KMP) Pattern Matching Substring Search - First Occurrence Of SubstringCount Total Unique Binary Search Trees - The nth Catalan Number (Dynamic Programming)Print Nodes K Level Far | Solution | Binary Tree in JAVA | Data Structure and AlgorithmsSearch A 2D Sorted Matrix - Fundamentals of Search Space ReductionImplement A Binary Heap - An Efficient Implementation of The Priority Queue ADT (Abstract Data Type)Minimum Window Substring: Utilizing Two Pointers & Tracking Character Mappings With A HashtableClone A Linked List (With Random Pointers) - Linear Space Solution & Tricky Constant Space SolutionTest If A Binary Tree Is Height Balanced ("Balanced Binary Tree" on LeetCode)How I got a $500K job at Facebook (as a software engineer).All Nodes Distance K in Binary Tree | leetcode 863 | HindiThe Ultimate Big O Notation Tutorial (Time & Space Complexity For Algorithms)Find The Longest Increasing Subsequence - Dynamic Programming FundamentalsLecture 7: Counting Sort, Radix Sort, Lower Bounds for SortingBinary Tree Bootcamp: Full, Complete, & Perfect Trees. Preorder, Inorder, & Postorder Traversal.Sort A K Sorted Array - Investigating Applications of Min/Max HeapsLowest Common Ancestor Between 2 Binary Tree Nodes (A Recursive Approach)ALL NODES DISTANCE K IN BINARY TREE (Leetcode) - Code & Whiteboard