Working with Lists

You must be proficient in working with lists. Lists form the core of most data structures that you might use later on. Here are some basic list operations (algorithms) that you should think through and implement. For the sake of simplicity all our lists are composed solely of whole numbers.

  1. Sum the elements in a 1-D and 2-D list.
  2. Find the maximum and minimum in a 1-D and 2-D list.
  3. Find the second highest or second lowest number in a 1-D or 2-D list.
  4. Remove all duplicate elements in a 1-D list.
  5. Given two 1-D lists, determine if they have exactly the same elements and in the same order.
  6. Given two 1-D lists determine if they have the same elements but not necessarily in the same order.
  7. Given two 1-D lists of the same length, determine the scalar product of them.
  8. Given a 1-D list obtain another list that has the cummulative sum of the elements of the first one.
  9. Sum two 2-D lists having the same number of rows and the same number of columns.
  10. (For Math Majors) Given two 2-D lists representing two matrices obtain a third 2-D list that is the matrix product of the first two.