AVL, KMP and PriorityQueue