Finding minimum in list
|
03-22-2017, 05:42 PM
Post: #7
|
|||
|
|||
RE: Finding minimum in list
(03-22-2017 05:29 PM)DrD Wrote: In my particular application it so happens that I do want the first occurrence if there are the multiple elements with the same first value. I haven't specifically tried this approach, but I have used loop constructs that did pretty much the same thing. Thank you for your idea! This is only tangential to your posts, but loops are generally slower than using MAKELIST. Even creating a custom function that replicates the content within a loop, and using that function with MAKELIST, would gain you a bit more speed (more significant if you are working with many iterations/large sets). SORT works well for small lists, and even handles lists within lists using SORT(list, index) -- which, by the way, is not documented in the Help screen. For much larger sets, the SORT algorithm would lose out to MAKELIST and MIN (the latter is linear time in the size of the list). Even the fastest sorting algorithm is still around \( O(n \log n ) \), i.e. not linear. Of course, nothing beats the code brevity of SORT. Graph 3D | QPI | SolveSys |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Finding minimum in list - DrD - 03-22-2017, 03:14 PM
RE: Finding minimum in list - Han - 03-22-2017, 03:30 PM
RE: Finding minimum in list - DrD - 03-22-2017, 05:29 PM
RE: Finding minimum in list - Han - 03-22-2017 05:42 PM
RE: Finding minimum in list - Tyann - 03-23-2017, 05:38 AM
RE: Finding minimum in list - DrD - 03-25-2017, 02:25 PM
RE: Finding minimum in list - Han - 03-25-2017, 03:10 PM
RE: Finding minimum in list - Didier Lachieze - 03-22-2017, 04:06 PM
RE: Finding minimum in list - Han - 03-22-2017, 04:11 PM
RE: Finding minimum in list - Han - 03-22-2017, 04:32 PM
RE: Finding minimum in list - DrD - 03-23-2017, 10:18 AM
RE: Finding minimum in list - John P - 03-26-2017, 04:11 AM
RE: Finding minimum in list - cyrille de brébisson - 03-28-2017, 10:30 AM
RE: Finding minimum in list - DrD - 03-28-2017, 01:52 PM
RE: Finding minimum in list - DrD - 03-29-2017, 10:54 AM
RE: Finding minimum in list - Didier Lachieze - 03-29-2017, 06:50 PM
|
User(s) browsing this thread: 1 Guest(s)