• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Implementing Hashtable and linked list in java

 
pandu ranga
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I want to implement the Linked list, hash table functionality in java without using the standard API'S assuming they are not present.How Can I achieve this?

Regards
Pandu
 
Nitesh Kant
Bartender
Posts: 1638
IntelliJ IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Firstly, why do you want to do it?
Have you tried something? Where is it that you are stuck?
 
Chirag Mehta
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose the requirement is that you don't want to use standard API i.e. you don't want to use java.util package and want to create a linklist or want to implement hashtable.

You can try 2 things
1. Use arrays but that need more memory management for an unbounded list.
2. Create a structure using innerclass that can hold the reference of objects.

Ask for further pointer if required.

Rgrds
Chirag
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Usually, a linked list internally has a structure that stores two or three references: that to the data stored, that to the successor (next node) and optionally that to the previous node.

That's exactly how java.util.LinkedList have done it, with one major difference. While most linked lists are actually that - linked lists, i.e. a chain of nodes, java.util.LinkedList uses a chain structure. It has a special node that connects the first and last node together. Please note that this is mostly for performance issues, because you can now go both ways when traversing the list, choosing the shortest path to any node.
 
Surya Kant
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Chirag,
Can you please elaborate more on how to go about implementing linked list without using data structures?I am really in need of that implementation.
Please help me..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic