• Post Reply Bookmark Topic Watch Topic
  • New Topic

Circular doubly linked list correct?  RSS feed

 
Pyuntae Chan
Greenhorn
Posts: 8
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have to guess at what the line of code would be to get a particular node information from a doubly linked list corresponding to each description using this diagram:


These are the questions:



I just want to check if my answers are correct. Here are my answers:

 
Campbell Ritchie
Marshal
Posts: 56584
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is a back value? What is a link value? Surely C should be getLink()? I think A B and D are correct but don't know about E and F.
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pyuntae Chan wrote:I just want to check if my answers are correct. Here are my answers:

Like Campbell, I'm a bit mystified as to what a "back value" is. However. the procedure is the same in all cases:

1. Start at the Node pointed to by the "letter" in the question.
2. Use next() or previous() as many times as needed to get to the required Node (preferably by the shortest route ).
3. Call whatever method is needed to get the required result - or none if the question asks for a Node.

HIH

Winston
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Winston Gutkowski wrote:preferably by the shortest route

Actually, that's not quite true.

You may get "brownie" points in this case for choosing the shortest route, but in the real world, you may not know what that is in advance.

Winston
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!