diff --git a/02-splay_operation/cpp/splay_operation.h b/02-splay_operation/cpp/splay_operation.h index a4f03e83cf32902406d6ead228ce25f797733580..5d7bd11c77c0fa068cb7d9a28ce8448dde9f042d 100644 --- a/02-splay_operation/cpp/splay_operation.h +++ b/02-splay_operation/cpp/splay_operation.h @@ -30,7 +30,7 @@ class Tree { // Rotate the given `node` up. Perform a single rotation of the edge // between the node and its parent, choosing left or right rotation // appropriately. - void rotate(Node* node) { + virtual void rotate(Node* node) { if (node->parent) { if (node->parent->left == node) { if (node->right) node->right->parent = node->parent; @@ -133,7 +133,7 @@ class Tree { // Splay the given node. // If a single rotation needs to be performed, perform it as the last rotation // (i.e., to move the splayed node to the root of the tree). - void splay(Node* node) { + virtual void splay(Node* node) { // TODO: Implement }