1. Well since this is the non-web discussion forum I guess this belongs here...

Has anyone any ideas how to write a Pseudocode algorithm for calculating the mode of a set of 10 numbers using arrays?

I've worked out bits and pieces here and there of it ut I can't seem to get a logical "program" out at the end of it... so if anyone out there is good a bit of help would be much appreciated

5 TD to anyone that can do it

John

2.

3. What do you need it for? If it's homework, we don't do that sort of thing.

4. No, writing a VB maths application that does numerous things, and following College I learnt to do everything in steps - Flowchart/Pseudocode - then into the designated language.

Functions such as graphing, averaging (Bar mode!), triganomic (sp?) aren't too difficult as linear mathematical commands can be used and/or constants defined. Unfortunately, I've never been good with Arrays (Which it would seem I need to be using here) in any language, so that's why I posted here.

Maybe I ought to rethink the way I type posts if I come across as an early teenager.... Or did I miss an offensive comment?

5. Define array length variable for size of array and set it to 9 (this will allow you to change the size of the array if you ever need to; since 9 encompasses 0 to 9, which is 10 numbers)

Define array of size array length variable

Define second two-dimensional array of undetermined length and width 1; your 0 column will be your value, and your 1 column will be your frequency

Loop from 0 to array length variable,
- assign value to each array element (or however you want to assign the values to the array; they can come from a database, whatever)

Loop from 0 to array length variable again
- check to see if array element value matches any preassigned second array (0) values
- if there is a match in second array (0) values, the corresponding second array (1) value increments by 1
- if there is no match, then a new row for your second array will be created with values of array element value for (0) value and 1 for (1) value (since it's the first occurrence of the array)

Sort your two-dimensional array in descending order by (1) column

Display first (0) element in sorted array as a mode

Display any subsequent (0) elements in sorted array where (1) element = first (1) element in sorted array as modes as well.

This is about as close as I can write it to making sense without actually putting any programming into it.

6. Thanks a lot TheGAME, I was missing a two dimentional array and was instead trying to recreate a similar effect with two separate arrays... which obviously was working very well!

TD awarded (I hope)

Regards,
John

7. Yes, I did get them. Thanks, man.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•
All times are GMT -6. The time now is 03:49 PM.