Back to Browse

Binary Tree - 74: Get Right node of given value in Binary Tree

1.1K views
Jan 20, 2020
17:06

Source Code:https://thecodingsimplified.com/get-right-node-of-given-value-in-binary-tree/ Solution - 1: - Get level of node - Now we'll tweak in function: print all values in level - When our value macthes, we'll set flag as true, now when next value occurs for same level, we check if flag is true, store as out answer Time Complexity: O(n) Space Complexity: O(1) Solution - 2: - We traverse the binary tree level order using queue - If we get value, we set flag as true - Now for next value we check, if flag is true, then return current node as answer Time Complexity: O(n) Space Complexity: O(1) Do Watch video for more info CHECK OUT CODING SIMPLIFIED https://www.youtube.com/codingsimplified ★☆★ VIEW THE BLOG POST: ★☆★ http://thecodingsimplified.com I started my YouTube channel, Coding Simplified, during Dec of 2015. Since then, I've published over 200+ videos. ★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★ https://www.youtube.com/codingsimplified?sub_confirmation=1 ★☆★ Send us mail at: ★☆★ Email: [email protected]

Download

0 formats

No download links available.

Binary Tree - 74: Get Right node of given value in Binary Tree | NatokHD