finding the most repeated name in a stack
I am new to programming, so please accept my apologies if this question is simple.
My teacher wants us to create a method that searches a stack for the name that occurs most often and returns it
for example : If I have these names in my stack:
Tiger Woods, Jack Nicholas, Arnold Palmer, Jack Nicholas, Jimmy Demerrit, Jack Nicholas, Sam Sneed, Jimmy Demerrit, Ben Hogan, Walter Hagen, Tommy Armor, Bobby Jones
the method should return Jack Nicholas
Please help me for I need to know how to do it for my program
thank you in advance
Re: finding the most repeated name in a stack
Welcome to Java Programming Forums. Try to read the forums Rules.
How will you solve this problem if you try to do it manually? Take a copy and pencil, draw a stack with the above data and try doing how you will reach the solution. Write all the steps and then program those steps. If you stuck in some kind of error in your program, you can ask here.
Re: finding the most repeated name in a stack
Try this out if you get stuck:
Java Platform SE 7