Click to See Complete Forum and Search --> : [RESOLVED] Finding numbers that happen most often?


BytePtr
February 21st, 2008, 05:24 PM
I need some algo gurus. Here is a problem.

I have numbers from 1 to 64. They are always different in that range.
Many of them happen many times, some of them not.

I just want to create simple app where i must enter all numbers that i choose just randomly and app then calculates the numbers that happen most often and diplays them.
User should be able to enter unlimited count of numbers.

1 3 5 8 9 15 16 17 24 28 29 31 37 39 40 42 48 50 51 59 3 6 7 9 10 15 18 21 27 28 29 31 34 42 43 45 46 49 50 62 4 6 7 8 13 23 25 26 27 30 32 34 38 41 45 48 51 57 59 64 9 15 16 17 20 22 26 27 29 32 34 39 40 41 42 43 52 57 58 62
For example nr. 27, 22, 15 and 62 etc.. happens most often (as you see from numbers table)and i must know that (app should tell me that).



Do you understand?

Any algo for such thing? I dont want you to code me this but i need just some tips and help how to do this.

Im coding mostly in Delphi (Pascal).

BytePtr
February 21st, 2008, 10:58 PM
Hehe.
Like always i find solution after posting question.
I made it in Delphi 5, coz its alot easier do that in Delphi that VB.
I dont like VB so much.

Screenshot:
http://img239.imageshack.us/img239/9937/donemz4.jpg



You see there is number 2 four times in left listbox, it shows 2 x 4 in right listbox. All correct.
There is nr 22 two times: it shows 22 x 2.
etc etc etc...


Like you see, it works :) Thats what i wanted.
All i have to do is add some chart and thats all. Would be easier to look than the numbers.

Hucoder
March 6th, 2008, 10:20 AM
Hehe.
Like always i find solution after posting question.
I made it in Delphi 5, coz its alot easier do that in Delphi that VB.
I dont like VB so much.

Screenshot:
http://img239.imageshack.us/img239/9937/donemz4.jpg



You see there is number 2 four times in left listbox, it shows 2 x 4 in right listbox. All correct.
There is nr 22 two times: it shows 22 x 2.
etc etc etc...


Like you see, it works :) Thats what i wanted.
All i have to do is add some chart and thats all. Would be easier to look than the numbers.

Glad you found an answer, but do make a note of this, in statistics the most common value in a list of values is called "the mode of the data". This may help in future when you explore search engines on this issue.