• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help in understanding the add method particularly addBefore of linkedList Implementation

 
Sandeep Dharwar
Greenhorn
Posts: 4
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone walk me through the logic of the addBefore method in 2 cases when the list is empty and when there are several elements in the list. I have included the necessary code required for the understanding of this operation.










Thanks in advance.
 
Winston Gutkowski
Bartender
Pie
Posts: 10527
64
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sandeep Dharwar wrote:Can someone walk me through the logic of the addBefore method in 2 cases when the list is empty and when there are several elements in the list. I have included the necessary code required for the understanding of this operation.

My suggestion would be to draw it out on a piece of paper, maybe something like:and now think about (and write down) the operations needed to add a new node before B.

Winston
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic