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.
- Sum the elements in a 1-D and 2-D list.
- Find the maximum and minimum in a 1-D and 2-D list.
- Find the second highest or second lowest number in a 1-D
or 2-D list.
- Remove all duplicate elements in a 1-D list.
- Given two 1-D lists, determine if they have exactly the same
elements and in the same order.
- Given two 1-D lists determine if they have the same elements
but not necessarily in the same order.
- Given two 1-D lists of the same length, determine the scalar
product of them.
- Given a 1-D list obtain another list that has the cummulative
sum of the elements of the first one.
- Sum two 2-D lists having the same number of rows and the same
number of columns.
- (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.