Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBP] Array Value Finder

Author
Message
Madscientist
14
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 21st Mar 2010 22:41 Edited at: 21st Mar 2010 22:41
I made a little function that finds the largest or smallest value position in an existing array.
For the value parameter either enter the string "smallest" or "largest" (No capitals) to find that position in the array.
Hope someone finds this usefull.

Function:


Demo:


If it hasn't exploded yet, I haven't touched it.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Mar 2010 15:43
Isn't that code a little complex for such a simple thing?


To find the highest entry, use the same again, but reverse the comparison.

Madscientist
14
Years of Service
User Offline
Joined: 23rd Aug 2009
Location: Between a rock and a hard place
Posted: 22nd Mar 2010 22:08
Well it helps if you want to find the second or third lowest/highest values to since it organizes all of the values.

If it hasn't exploded yet, I haven't touched it.
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 23rd Mar 2010 21:26
You might want to look into a quicksort algorithm, it's much much faster than simply searching through everything.


Login to post a reply

Server time is: 2024-04-19 23:27:39
Your offset time is: 2024-04-19 23:27:39