|
-
Mar 9th, 2010, 04:06 PM
#1
Thread Starter
Hyperactive Member
Sorting Counting Output
Hello Everyone:
I am trying to sort around 3 million results that are numbers (int) between 1 and 100. I want to know which number in the record set appears the most often, and continue sorting the results until all the numbers are ranked with the one that is in the set most often at the top and sorted downward.
I am not sure what my next step is, please list all the steps you think I should use. Can I insert an Excel table in my program?
Thanks
Art
SLEEP: A Totally Inadequate Substation For Caffeine!
-
Mar 10th, 2010, 08:14 PM
#2
Banned
Re: Sorting Counting Output
example:
'If your data were saved in Num() array;
dim hs as new hashtable
for i as integer=0 to 3000000-1
if not hs.containkey(num(i)) then hs.add(num(i),0)
hs(num(i).value = ctype(hs(num(i)).value, integer)+1
next
dim ary as new arraylist
for each de in hs
if ctype(de.value)>0 then ary.add(de.key)
next
ary.sort()
'output
dim outputStr as new stringbuilder()
for i as integer=0 to ary.length-1
outputStr.append(ary(i).tostring() & " : " & ctype(hs(ary(i)).value, integer) & " records" & controlchars.cr)
next
---------------------------
Sabrina Gage
Last edited by si_the_geek; Apr 7th, 2010 at 05:27 PM.
Reason: removed advertising link
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|