-
-
Save tanzaku/d6c73ca4cd1757906ddd62d1ac60df90 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static Node merge(Node l, Node r) { | |
if (l == null || r == null) return l == null ? r : l; | |
Node v = peekFirst(r); // O(h) | |
return join(l, v, removeFirst(r)); // O(h(l) - h(r)) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment