Examples
Input: ((('a', 1, [('b', 2, [('d', 4, []), ('e', 5, [])]), ('c', 3, [('f', 6, [])])]), ('a', 1, [('c', 3, [('f', 66, [])])])))
Expected Output: 4
Explanation: `b`, `d`, and `e` are removed, which contributes 3. Node `f` stays in the same position but its value changes from 6 to 66, contributing 1 more.
Input: ((('a', 1, [('b', 2, [('d', 4, []), ('e', 5, [])]), ('c', 3, [('g', 7, [])])]), ('a', 1, [('b', 2, [('e', 5, []), ('d', 4, []), ('f', 6, [])]), ('h', 8, [('g', 7, [])])])))
Expected Output: 5
Explanation: Under `b`, child order changes but that does not matter; only `f` is added there (+1). Subtree `c -> g` is removed (+2). Subtree `h -> g` is added (+2). Total = 5.
Input: (None, None)
Expected Output: 0
Explanation: Both trees are empty, so nothing changed.
Input: (('a', 1, []), ('a', 2, []))
Expected Output: 1
Explanation: The root node stays in the same position and only its value changes.
Input: (('a', 1, [('b', 2, [('x', 9, [])]), ('c', 3, [])]), ('a', 1, [('b', 2, []), ('c', 3, [('x', 9, [])])]))
Expected Output: 2
Explanation: Node `x` moved from under `b` to under `c`. That is counted as removing `x` from its old position (+1) and adding `x` at its new position (+1).
Input: (('a', 1, [('b', 2, []), ('c', 3, [])]), ('z', 1, [('b', 2, [])]))
Expected Output: 5
Explanation: The root key changes from `a` to `z`, so the entire old tree is removed (3 nodes) and the entire new tree is added (2 nodes).