pathBetween
The shortest path of nodes from this node to other, inclusive of both endpoints.
The path ascends from this node up to their lowestCommonAncestor and then descends to other; the common ancestor appears exactly once. When this === other the result is listOf(this). When one node is an ancestor of the other the path is simply the chain between them.
Return
the path [this, …, lca, …, other], or null when the two nodes belong to different trees.
Runs in O(da + db) time and space, where da/db are the depths of the two nodes.
Parameters
other
the node the path ends at.