diff --git a/curriculum/challenges/english/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md b/curriculum/challenges/english/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md index 43d58845d26..a359575e5f7 100644 --- a/curriculum/challenges/english/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md +++ b/curriculum/challenges/english/10-coding-interview-prep/data-structures/delete-a-leaf-node-in-a-binary-search-tree.md @@ -46,6 +46,25 @@ assert( ); ``` +Trying to remove an element from an empty tree should return `null`. + +```js +assert( + (function () { + var test = false; + if (typeof BinarySearchTree !== 'undefined') { + test = new BinarySearchTree(); + } else { + return false; + } + if (typeof test.remove !== 'function') { + return false; + } + return test.remove(100) == null; + })() +); +``` + Trying to remove an element that does not exist should return `null`. ```js @@ -60,6 +79,8 @@ assert( if (typeof test.remove !== 'function') { return false; } + test.add(15); + test.add(30); return test.remove(100) == null; })() );