Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

help!

Thread Tools
 
Search this Thread
 
Old 02 April 2002, 04:31 PM
  #1  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

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
Old 03 April 2002, 11:16 AM
  #2  
Dream Weaver
Scooby Regular
 
Dream Weaver's Avatar
 
Join Date: Feb 2000
Location: Lancashire
Posts: 9,844
Received 0 Likes on 0 Posts
Wink



Shouldn't you have learnt this in your lectures

DW
Old 03 April 2002, 02:28 PM
  #3  
DazV
Scooby Regular
 
DazV's Avatar
 
Join Date: Jun 2000
Posts: 3,783
Likes: 0
Received 0 Likes on 0 Posts
Post

hehe, takes me back to A'Level Computer Science when I was 17!

Love it - no help from me - get stuck in!!!

-DV
Old 03 April 2002, 03:29 PM
  #4  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

What about inheritance polymorphism? That doesn't 'change' any base classes, it demonstrates good OOP methodology so you should be able to use that
Old 03 April 2002, 04:07 PM
  #5  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

lecture note arent brillaint! in fact there ****!!

there no use at all
Old 03 April 2002, 04:22 PM
  #6  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

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.

Old 03 April 2002, 08:19 PM
  #7  
super_si
Scooby Regular
Thread Starter
 
super_si's Avatar
 
Join Date: Feb 2002
Location: Lurkin Somewhere
Posts: 7,951
Likes: 0
Received 0 Likes on 0 Posts
Post

i thought you need 4 classes when using linked list?
Old 04 April 2002, 08:42 AM
  #8  
stevencotton
Scooby Regular
 
stevencotton's Avatar
 
Join Date: Jan 2001
Location: behind twin turbos
Posts: 2,710
Likes: 0
Received 1 Like on 1 Post
Post

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.





All times are GMT +1. The time now is 02:14 PM.