2. Find and fix the bugs in the following C/C++ function that is supposed to remove the head element from a singly linked list: void removeHead(Node *head){ delete head; head = head->next; }
3. Given a singly-linked list, devise a time- and space-efficient algorithm to find the mth-to-last element of the list. Implement your algorithm, taking care to handle relevant error conditions. Define mth to last such that when m=0, the last element of the list is returned.
4. Write a function that takes a pointer to the head of a list and determines whether the list is cyclic or acyclic. Your function should return false if the list is acyclic and true if it is cyclic. You may not modify the list in any way.
5. Perform a preorder traversal of a binary search tree, printing the value of each node, but this time you may not use recursion.
6. Given the value of two nodes in a binary search tree, find the lowest (nearest) common ancestor. You may assume that both values already exist in the tree.
7. Given two binary trees, find whether or not they are equal. Being equal means that they have the same values and same structure.
8. How do you merge n sorted lists with average length K in O(n*log(K)) time?
9. Design an algorithm and write code to find two numbers in an array whose sum equals a given value.
10. Given an array of integers, find the contiguous sub-array with the largest sum.
11. Given 2 files, each with names of thousands of customers who bought something from Amazon.com on that particular day. Find the common customers (i.e. common names in file1 and file2)
12. Given a file containing approx 10 million words. Design a data structure for finding all the anagrams in that set.