I have this tree: And I want to transform the data in this format so I can display with React-Flow (example here: https://reactflow.dev/examples/layouting/ This is the format I want: So ultimately I need to convert it to an array, get all the keys as id and get to find source and destination, based on parent/child structure. I would appreciate any
Tag: binary-tree
Explain how recursion works in an algorithm to determine depth of binary tree?
I am new to data structures in JavaScript and am trying to learn Binary Search Trees. I was following along with a blog post and was able to get a working solution to the problem of finding the max depth in a BST, but it’s unclear to me how the recursion is working and how the +1 gets added on