private AVLNode helperInsert(AVLNode n, E data){
		if(n == null){
			n = new AVLNode(data);
		}else{
			// compare the new data with the data at the current node
			int cmp = comparator.compare(data, n.data);
			if(cmp == 0) {            // a. Current node is a match
				n.count++;
			}else if(cmp < 0){
				n.left = helperInsert((AVLNode)n.left,data);
				if(heightFactor(n) >= 2||heightFactor(n) <= -2){
					if(comparator.compare(data, n.left.data)< 0){
						n = rotateLeftLeft(n);
					}else{
						n = rotateLeftRight(n);
					}
				}
			}else{
				n.right = helperInsert((AVLNode)n.right, data);
				if(heightFactor(n) >= 2||heightFactor(n) <= -2){
					if(comparator.compare(data, n.right.data)<0){
						n = rotateRightLeft(n);
					}else{
						n = rotateRightRight(n);
					}
				}
			}

		}
		n.height = determineHeight(n);
		return n;
	}