...

/

Antipattern: Always Depend on One’s Parent

Antipattern: Always Depend on One’s Parent

Let's take a look at some drawbacks of maintaining trees with an Adjacency List.

Let’s imagine a query in which there is a need to retrieve the parents or children of a node. What should be our solution to such a query?

The answer is Adjacency List.

Any solution that we would find for this problem would include modifying the code that manages the tree data structures. Let’s discuss it in detail.

Adjacency list

The solution we might first think of, and that is commonly shown in ...