Tag: binary_tree
Binary Right Side View - DFS approach
Date: 3/2/2024Tags:algorithmsleetcodebinary_treedepth_first_searchUsing a depth-first search approach, this journal entry explores the problem of finding the right side view of a binary tree by ensuring traversal prioritizes the rightmost node at each level, resulting in an algorithm that populates a 'rightside' list with the correct nodes seen from the right side.
Binary Tree Right Side View
Date: 3/2/2024Tags:algorithmsleetcodebinary_treeThe journal entry presents a solution to finding the right side view of a binary tree using a breadth-first search (BFS) approach with a queue, ensuring the capture of the rightmost node at each level, achieving the desired view, alongside a provided TypeScript code implementation for the problem statement.
Binary Tree Level Order Traversal
Date: 2/28/2024Tags:algorithmsleetcodebinary_treeThe journal entry discusses implementing a breadth-first search approach to solve the Binary Tree Level Order Traversal problem, utilizing a simulated queue with specific array structures and pointers, and an alternative technique using two arrays to optimize the traversal, with a related code block provided for reference.
Count Nodes Equal to Average of Subtree - 2nd attempt
Date: 2/10/2024Tags:algorithmsleetcodebinary_treeThis journal entry discusses a revised approach for counting nodes equal to the average of their subtree, introducing a modified `inspect` function that returns the sum, number of nodes, and number of valid nodes found within the subtree. The code provided implements this approach using a binary tree and recursive traversal.
Count Nodes Equal to Average of Subtree
Date: 2/9/2024Tags:algorithmsleetcodebinary_treeThe journal entry summarizes a solution to the problem of counting nodes that have a value equal to the average value of their subtrees, and includes a code implementation using a binary tree data structure.