budget/src/main/java/budget/backend/structures/AVLSearchTree.java
public boolean insert(K key){
		if (isEmpty()) {
			root = new AVLTreeNode<>(key);
			root.setLeft(empty);
			root.setRight(empty);
		} else {
			AVLTreeNode<K, V> n = findPlace(key, root);
			if (n.isEmpty()) return false;
			n.setLeft(empty);
			n.setRight(empty);
			updateHeight(n);
			reorderTree(n);
		}
		size++;
		return true;
	}
/**
	 * Publicly accessible insertion method. Insertion is similar to a simple binary search tree, but once the addition is done, the structure of the tree will be restored if necessary
	 * This method takes at most O(log n) time
	 * For Key-only trees
	 * @param key a Comparable instance
	 * @return true if the insertion was successfull
	 * @return false in case a node with the given key already exists in the tree
	 */
Publicly accessible insertion method. Insertion is similar to a simple binary search tree, but once the addition is done, the structure of the tree will be restored if necessary
This method takes at most O(log n) time
For Key-only trees
@param key a Comparable instance
@return true if the insertion was successfull
@return false in case a node with the given key already exists in the tree
Publicly accessible insertion method . Insertion is similar to a simple binary search tree but once the addition is done the structure of the tree will be restored if necessary This method takes at most O ( log n ) time For Key - only trees @param key a Comparable instance @return true if the insertion was successfull @return false in case a node with the given key already exists in the tree
public boolean insert(K key){
		if (isEmpty()) {
			root = new AVLTreeNode<>(key);
			root.setLeft(empty);
			root.setRight(empty);
		} else {
			AVLTreeNode<K, V> n = findPlace(key, root);
			if (n.isEmpty()) return false;
			n.setLeft(empty);
			n.setRight(empty);
			updateHeight(n);
			reorderTree(n);
		}
		size++;
		return true;
	}
public boolean insert ( K key ) { if ( isEmpty ( ) ) { root = new AVLTreeNode < > ( key ) ; root . setLeft ( empty ) ; root . setRight ( empty ) ; } else { AVLTreeNode < K , V > n = findPlace ( key , root ) ; if ( n . isEmpty ( ) ) return false ; n . setLeft ( empty ) ; n . setRight ( empty ) ; updateHeight ( n ) ; reorderTree ( n ) ; } size ++ ; return true ; }
Publicly accessible insertion method.
Publicly accessible insertion method .