• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementation of data structure(Link List)

 
Rubbal Bhusri
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can we Implement Link List in java as we do in C or C++ language ?
e.g.

Struct node{

int value;
node * link;

}*start;

Since there are no pointers in java, so how do we implement Link List in java ?
 
Saket Kumar Sinha
Ranch Hand
Posts: 32
Eclipse IDE Java Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


That may help
 
Stephan van Hulst
Bartender
Posts: 5334
48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java uses references instead of pointers.

Just give one node a reference to the next node.
 
Matthew Brown
Bartender
Posts: 4565
8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
References in Java are not as different to pointers in C++ as some people would have you believe, and they'll do what you want here (as Saket indicates). The real difference is that you can't do pointer arithmetic with them.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check this topic, it contains some guidelines on how to develop doubly linked list, you may find it helpful.
 
Rubbal Bhusri
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please give me a link where i can study about references more.
 
Campbell Ritchie
Sheriff
Posts: 48378
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Let’s try googling: I found 1 2 3 (maybe less good than the other two). There were lots more hits. I hope those hits are useful for you.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic