COM1201 Homework III Solution

1. (Orders of Magnitude)
Fill in the following table:
n n3 n2 nlg(n) lg(n)
10 1000 100 33.22 3.32
100 1000000 10000 664.39 6.64
1000 1000000000 1000000 9965.78 9.97
10000 1000000000000 100000000 132877.12 13.29
100000 1000000000000000 10000000000 1660964.05 16.61
1000000 1000000000000000000 1000000000000 19931568.57 19.93
where lg(n) is base 2.

2. (Big-O) Each of the functions shown below is to act on a dynamic set. For each function discuss Big-O of the number of comparisons (minimum, maximum, average) if:
a. The set is maintained as an unordered simply linked list.
b. The set is maintained as an ordered simply linked list.
c. The set is maintained as an ordered doubly linked list.

Note: I intended that x be passed by a pointer as in the last homework. My answers are based on that assumption. Assume the list has n elements.


Last Updated: April 16, 1997 12:29 pm by

Harriet Fell
College of Computer Science, Northeastern University
360 Huntington Avenue #161CN,
Boston, MA 02115
Internet: fell@ccs.neu.edu
Phone: (617) 373-2198 / Fax: (617) 373-5121
The URL for this document is: http://www.ccs.neu.edu/home/fell/COM1101/HW/HW3/hw3Solution.html