Skip to content
Advertisement

Tag: binary-tree

Method to delete certain level of binary tree

I have class SimpleTree just basic binary tree: And the problem is to write method: Where level is the level of the elements in some tree (root level == 0). For example level == 1: Only LEFT leaf of DELETED elements is saved, if we dont have such -> save the right. Answer Your tree seems to be a recursive

How exactly does return statement work in recursive function?

I’m having a hard time approaching any binary tree questions and most of them are recursive, so I decided to detour and start from the basics again. This is basically the pre-order traversal list. I’ve identified two ways that can give me the correct results if there is at least 1 node, but I’m unsure about the intrinsic differences between

Serialize and Deserialize Binary Tree

I am working on the LeetCode problem 297. Serialize and Deserialize Binary Tree: Serialization is the process of converting a data structure or object into a sequence of bits so that it can be stored in a file or memory buffer, or transmitted across a network connection link to be reconstructed later in the same or another computer environment. Design

Advertisement