Results 1 to 3 of 3
Thread: Implementing a stack as an array
- 06-22-2011, 03:31 PM #1Member
- Join Date
- Feb 2011
- Rep Power
- 06-22-2011, 03:52 PM #2
Underneath a lot of collection classes there are arrays. What that means is you have to be able to resize the array ie create a larger one and copy old one,
or have some logic that will span/jump from one array to another depending on the index value. For example the first array would be for indexes 0-99, the next for indexes 100 to 599 etc. Your logic would convert an index of 102 to 2 and use the second array.
- 06-22-2011, 03:55 PM #3
I'm not 100% sure what you're trying to accomplish, but is there a reason why you can't use an ArrayList? Since the size isn't set in stone you would be able to make your needed array as big as you need.
- Use [code][/code] tags when posting code. That way people don't want to stab their eyes out when trying to help you.
- +Rep people for helpful posts.
- By shashankc in forum New To JavaReplies: 5Last Post: 01-20-2011, 01:49 PM
- By rhm54 in forum New To JavaReplies: 3Last Post: 12-01-2010, 11:28 AM
- By sfe23 in forum New To JavaReplies: 0Last Post: 02-24-2009, 04:19 PM
- By szimme101 in forum New To JavaReplies: 1Last Post: 03-25-2008, 06:06 AM
- By pompeez in forum New To JavaReplies: 2Last Post: 08-13-2007, 02:41 PM