Results 1 to 3 of 3
Thread: Creating a stack with data
- 07-02-2007, 09:31 AM #1
Member
- Join Date
- Jun 2007
- Posts
- 21
- Rep Power
- 0
Creating a stack with data
I have to create a class 'Dear' that has a stack that will allow addition of 'event' information into it. The event information will include event type and date of event. All the data has to be sorted automatically while it is being added into the stack.
Please help me with this because I am not sure of how to do this.
- 07-02-2007, 10:02 AM #2
If the stack objects need to be sorted then it is not called as stack anymore and implementing a stack for that purpose is unnecessary. Just use an ArrayList or Vector and while inserting an element search for the correct position and call insert method.All the data has to be sorted automatically while it is being added into the stack.
If there are some performance issues, you might search for a better data structure since, in my way, insertion can be slow when lots of data exist in a vector.
- 07-02-2007, 03:28 PM #3
Member
- Join Date
- Jun 2007
- Posts
- 21
- Rep Power
- 0
Similar Threads
-
Stack data structure in Java
By Java Tip in forum java.langReplies: 0Last Post: 04-16-2008, 10:34 PM -
JVM terminated while creating a new Data-Source
By woeko in forum EclipseReplies: 0Last Post: 01-03-2008, 12:28 PM -
Stack Trace
By Java Tip in forum Java TipReplies: 0Last Post: 12-10-2007, 05:29 PM -
Help Creating A Graph From Inputted Data
By adlb1300 in forum New To JavaReplies: 6Last Post: 10-28-2007, 04:45 AM -
Help with heap and stack
By coco in forum Advanced JavaReplies: 1Last Post: 08-06-2007, 02:21 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks