Linked list and some related algorithms