Linked lists and binary trees for javascript