Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

implement a list

 
Isaac Ferguson
Ranch Hand
Posts: 837
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have the question. I am trying to discover the answer , but I have no idea.



Any ideas, please?

Regards
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well the ArrayList class uses an array internally, so that would probably be a good approach to take.
 
Mack Wilmot
Ranch Hand
Posts: 88
Linux Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a couple of basic underlying structures you can use for a list, depending on how it is to be used. One is easy to access elements with an index and the other is more efficient for inserting elements into the middle of the list. The required methods in the question points toward one of these structures, do you know which one and what it is?
 
Campbell Ritchie
Sheriff
Posts: 48652
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Or you can search posts from today and yesterday and see how people are implementing linked lists. You would obviously have to write your own code, only using what you find as inspiration.
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mack Wilmot wrote:One is easy to access elements with an index and the other is more efficient for inserting elements into the middle of the list.

The specification never said it had to be efficient
 
Mack Wilmot
Ranch Hand
Posts: 88
Linux Netbeans IDE Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joanne Neal wrote:
Mack Wilmot wrote:One is easy to access elements with an index and the other is more efficient for inserting elements into the middle of the list.

The specification never said it had to be efficient


It doesn't require inserting elements into the middle of the list either.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic