budget/src/main/java/budget/backend/structures/AVLSearchTree.java
public AVLTreeNode<K,V> remove(K key){
		AVLTreeNode<K,V> node = findKey(key, root);
		AVLTreeNode<K,V> ext = empty;
		//two cases are considered: node is leaf or not
		if (!(node.isEmpty())){
			if (node.isLeaf())
				ext = removeLeaf(node);
			else{
				//initialise a pointer to the next element in an inorder traversal
				ext = nextLeftLeaf(node.getRight());
				removeLeaf(ext);
				//switch the external leaf and the node
				sw(node,ext);
			}
			reorderTree(ext);
			size--;
			return node;
		}
		return null;
	}
/**
	 * Remove a node from the tree with the given key
	 * @return the removed AVLTreeNode
	 */
Remove a node from the tree with the given key
@return the removed AVLTreeNode
Remove a node from the tree with the given key @return the removed AVLTreeNode
public AVLTreeNode<K,V> remove(K key){
		AVLTreeNode<K,V> node = findKey(key, root);
		AVLTreeNode<K,V> ext = empty;
		if (!(node.isEmpty())){
			if (node.isLeaf())
				ext = removeLeaf(node);
			else{
				ext = nextLeftLeaf(node.getRight());
				removeLeaf(ext);
				sw(node,ext);
			}
			reorderTree(ext);
			size--;
			return node;
		}
		return null;
	}
public AVLTreeNode < K , V > remove ( K key ) { AVLTreeNode < K , V > node = findKey ( key , root ) ; AVLTreeNode < K , V > ext = empty ; if ( ! ( node . isEmpty ( ) ) ) { if ( node . isLeaf ( ) ) ext = removeLeaf ( node ) ; else { ext = nextLeftLeaf ( node . getRight ( ) ) ; removeLeaf ( ext ) ; sw ( node , ext ) ; } reorderTree ( ext ) ; size -- ; return node ; } return null ; }
Remove a node from the tree with the given key
 @return the removed AVLTreeNode
Remove a node from the tree with the given key @return the removed AVLTreeNode
//two cases are considered: node is leaf or not //initialise a pointer to the next element in an inorder traversal //switch the external leaf and the node