help!
#1
Scooby Regular
Thread Starter
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes
on
0 Posts
You decide that your solution to project A will be too slow to be useful when used with a real telephone directory and make the following changes to attempt to improve the performance of your program (a sample solution to Project A will be made available if you require it).
1). Provide an implementation of the Directory interface using the LinkedList class described in lectures (NOT the Java Collections List Class). You MUST NOT CHANGE the LinkedList class – marks will be deducted for anyone whose solution relies upon changing the LinkedList or LinkedListIterator implementation given.
2). The changes in 1) should make adding, deleting and modifying records more efficient but will probably increase the time to lookup numbers. To overcome this you use a technique called hashing. Instead of storing all the records on one list you use a series of lists. The data for all people whose surname begins with ‘A’ is stored on the first list, records for all people whose surname begins with ‘B’ on a second list and so on. Provide an implementation of the Directory interface using this technique.
Again, you should measure the performance for the best, worst and average cases of implementations 1) and 2) above. Compare the efficiency of each implementation in your documentation
er....stuck again
1). Provide an implementation of the Directory interface using the LinkedList class described in lectures (NOT the Java Collections List Class). You MUST NOT CHANGE the LinkedList class – marks will be deducted for anyone whose solution relies upon changing the LinkedList or LinkedListIterator implementation given.
2). The changes in 1) should make adding, deleting and modifying records more efficient but will probably increase the time to lookup numbers. To overcome this you use a technique called hashing. Instead of storing all the records on one list you use a series of lists. The data for all people whose surname begins with ‘A’ is stored on the first list, records for all people whose surname begins with ‘B’ on a second list and so on. Provide an implementation of the Directory interface using this technique.
Again, you should measure the performance for the best, worst and average cases of implementations 1) and 2) above. Compare the efficiency of each implementation in your documentation
er....stuck again
#6
Scooby Regular
All you need to do is modify the existing data structure and your add/delete/edit methods to suit, and benchmark it against your existing implementation.
Steve.
Steve.
Trending Topics
#8
Scooby Regular
A linked list is just a data structure, class independent. If it's a linked list of objects, each object will be of the same class (of type 'person') but 'next'/'previous'/whatever will point to another instance of the same object. Means your constructors and destructors will have to re-arrange those pointers upon new object creation and destruction.
Steve.
Steve.