• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Junilu Lacar
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Ganesh Patekar
  • Tim Moores
  • Pete Letkeman
  • Stephan van Hulst
Bartenders:
  • Carey Brown
  • Tim Holloway
  • Joe Ess

Implementing Hashtable and linked list in java  RSS feed

 
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
 
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?
 
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
 
Sheriff
Posts: 21423
94
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.
 
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..
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!