It's not a secret anymore!*
The moose likes Beginning Java and the fly likes Pleas help with array Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Pleas help with array" Watch "Pleas help with array" New topic
Author

Pleas help with array

Ronald Pruitt
Ranch Hand

Joined: Jan 15, 2001
Posts: 32
I am working on an assignment that is to make a heap from an array. One thing I must do is if an item is already in the array it is not to be added again, but the value only to be incremented. I have had limited success in that I can get it to increment but the word is also added to the list. Also, when I place the first to values in the list they automatically increment, but elements after that do not. Can anyone help please.

in the test bed I have the following:

which when I ask it to print gives me;
The Heap values are: 1 = (Key-> dog, Count -> 2)
Ronald Pruitt
Ranch Hand

Joined: Jan 15, 2001
Posts: 32
I've continued trying to work on this but to no avail, can anyone help, please
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
I'm a little puzzled as to why you are doing this. Would a Map (such as a Hashtable or HashMap) not serve the purpose?
Consider:


Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Pleas help with array
 
Similar Threads
implementing linked list using core java
method to test if an item is in the list
explain method action please
print in Lexicographic
test bed for array based list implementation