adding algorithm for converting binary tree to linked list