What is the fastest and most memory-efficient data structure?
To put simply, I need to know what data structure will be the most memory-efficient, but still optimize speed as much as possible. Any information helps.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
What is the fastest and most memory-efficient data structure?
To put simply, I need to know what data structure will be the most memory-efficient, but still optimize speed as much as possible. Any information helps.
NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:
When asking for help, please follow these guidelines to receive better and more prompt help:
1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
2. Give full details of errors and provide us with as much information about the situation as possible.
3. Give us an example of what the output should look like when done correctly.
Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/
This is extremely dependent upon what the needs are, based upon requirements such as data storage, data retrieval, and data traversing.
I'll get back to you on that when I have more information.
For now, is anyone able to outline a few of the better data structures and their advantages/disadvantages. It would be very appreciated.
NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:
When asking for help, please follow these guidelines to receive better and more prompt help:
1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
2. Give full details of errors and provide us with as much information about the situation as possible.
3. Give us an example of what the output should look like when done correctly.
Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/
Technically, everything stored on your computer is in an array.
There is no one "most efficient" data structure. Every data structure has it's pluses and minuses. Some data structures are designed to take up less room while others are designed to give you more speed. Even within a category of data structures (such as heaps or trees) you will have multiple data structures which each are used for their own purposes.
For a list of some commonly used data structures, see List of data structures - Wikipedia, the free encyclopedia
aussiemcgr (November 21st, 2010)
NOTE TO NEW PEOPLE LOOKING FOR HELP ON FORUM:
When asking for help, please follow these guidelines to receive better and more prompt help:
1. Put your code in Java Tags. To do this, put [highlight=java] before your code and [/highlight] after your code.
2. Give full details of errors and provide us with as much information about the situation as possible.
3. Give us an example of what the output should look like when done correctly.
Join the Airline Management Simulation Game to manage your own airline against other users in a virtual recreation of the United States Airline Industry. For more details, visit: http://airlinegame.orgfree.com/
This is simply not true. I don't know why you'd say everything is stored in an array, when that's one of the primary reasons trees and nodes are around. Unless you're talking about at a physical hardware level, in which case it's still not true.
For the original question. I won't pretend I know everything, but when you say what data structure is the most memory efficient, if you're talking about storage space in either your primary or secondary memories then an int is an int, it takes up a particular amount of space no matter how you organise is. Arrays reserve a particular amount of space depending on how much space you allocate it.
With hard drives and ram getting as large as they are, it's rarely an issue about space or memory, but rather efficiency and speed.
In which case, trees using nodes are the most efficient I've come across so far. As long as the tree is balanced... Which is up to the programmer to do.