Binary search tree balancing from ordered array, creating linked list from BST