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
How would you do this without writing a program? Write it down on paper step by step. This is called pseudo-code and it's your first step towards an answer.