Flash Website Builder- Trendy Site Builder is a Flash Site Building tool that helps users build stunning websites. Check Out Custom Custom Logo Design by LogoBee. Website Design and Free Logo Templates available.
 CodingForums.com the mean, median and the mode

Before you post, read our: Rules & Posting Guidelines

Enjoy an ad free experience by logging in. Not a member yet? Register.
 05-02-2004, 11:12 PM PM User | #1 oyildirimoglu New to the CF scene   Join Date: Apr 2004 Location: London Posts: 7 Thanks: 0 Thanked 0 Times in 0 Posts the mean, median and the mode hi does any body now a pseudocode to calculate the following: 1) mean 2) median 3) mode for any 10 random numbers thanx for any help anyone is abel to provide
 05-02-2004, 11:45 PM PM User | #2 Antoniohawk Senior Coder   Join Date: Aug 2002 Location: Kansas City, Kansas Posts: 1,518 Thanks: 0 Thanked 2 Times in 2 Posts Put the numbers into an array. Mean: add all of the numbers together and divide by 10. Median: array[4] + array[5] / 2 I'm not sure of a way to calculate the mode though this might help you out: [http://forums.devshed.com/t46666/s.html] __________________ xhtml :: attributes . tags . vs. CSS :: Box Model Hack [CF T-Shirts] [CP Resources] [ithium hosting] [A New Generation of Tree Menu]
 05-03-2004, 11:19 AM PM User | #3 Mhtml Senior Coder     Join Date: Jun 2002 Location: Sydney, Australia Posts: 3,531 Thanks: 0 Thanked 1 Time in 1 Post Well thinking back to my primary mathematics days mode is the most frequently occurring score ( at least I hope it is ) ... Now there are a few ways you could go around it. Depending on how many scores you have, the easiest way might be to copy the array of scores into a 2d array and use the second dimension to tally the number of scores of each and then select the one with the greatest scrore. However the way I would do it would be to sort the scores first (asc or desc whichever your prefer) using whatever method you prefer.. I doubt you have more than say 20 scores so which sort you pick will work fine. After that counting is easy. [edit:] I'm suprised antonio didn't cite you on this but -- Your title could do with a few less exclaimation marks...it's hardly going to make us want to answer your post faster if even at all.. Edit: Removed the exclamation marks from it. /// liorean __________________ Omnis mico antequam dominus Spookster! Last edited by liorean; 05-03-2004 at 11:42 AM..
 05-03-2004, 11:55 AM PM User | #4 raf Master Coder   Join Date: Jul 2002 Posts: 6,589 Thanks: 0 Thanked 0 Times in 0 Posts Not all distributions are uni-mode. If these random numbers are completely randon without dumplicates, then each number will occer once and there is no mode. If you have 2 number each apearing twice or so, then you'll have a bi-modal distribution (2 modes). So there's no straightforward answer to your question since we don't know anything about the inputvalues. __________________ Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html
 05-03-2004, 12:55 PM PM User | #5 raf Master Coder   Join Date: Jul 2002 Posts: 6,589 Thanks: 0 Thanked 0 Times in 0 Posts So thay first need to be split up in groups of 10 elements? (according to your original question) So then you get 9,5,6,23,25,22,12,12,2,2 as the first group, which means you'll have 2 modi : 2 and 12 so your steps are : - sort element - count each values occurence - sort frequecys descending - report value with heighest frequence. - check if the next value has the same frequency and if so, also report it. __________________ Posting guidelines I use to see if I will spend time to answer your question : http://www.catb.org/~esr/faqs/smart-questions.html

 Bookmarks

 Thread Tools Rate This Thread Rate This Thread: 5 : Excellent 4 : Good 3 : Average 2 : Bad 1 : Terrible

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home :: Client side development     JavaScript programming         DOM and JSON scripting         Ajax and Design         JavaScript frameworks         Post a JavaScript     HTML & CSS     XML     Flash & ActionScript         Adobe Flex     Graphics and Multimedia discussions     General web building         Site reviews         Building for mobile devices :: Server side development     Apache configuration     Perl/ CGI     PHP         Post a PHP snippet     MySQL         Other Databases     Ruby & Ruby On Rails     ASP     ASP.NET     Java and JSP     Other server side languages/ issues         ColdFusion         Python :: Computing & Sciences     Computer Programming     Computer/PC discussions     Geek News and Humour Web Projects and Services Marketplace     Web Projects         Small projects (quick fixes and changes)         Medium projects (new script, new features, etc)         Large Projects (new web application, complex features etc)         Unknown sized projects (request quote)         Vacant job positions         Looking for work/ for hire         Project collaboration/ partnership         Paid work offers and requests (Now CLOSED)     Career, job, and business ideas or advice     Domains, Sites, and Designs for sale         Domains for sale         Websites for sale         Design templates and graphics for sale :: Other forums     Member Offers     Forum feedback and announcements

All times are GMT +1. The time now is 11:02 PM.