07-02-2020 06:49 AM
@altenbach wrote:
Here' are some ideas. Arguably simpler. 😉
Yeah I'll say, now that's what I call optimized. Kudos 😃 I have about a year and a half of experience in LabVIEW so I knew my solution could be cleaned up massively lol.
Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.
07-02-2020 09:54 AM
Well, I started programming in the early 70ies and still make mistakes. 🙂
As I mentioned in the beginning, your first code had duplicate results, which could be hard to detect without extensive testing. Since you have LabVIEW 2019, you have access to "sets", which allows for (1) quick sanity checks and (2) automatic elimination of all duplicates. As a bonus, it also gives the result in a nicer sort order.
If the equal comparison fails AND you don't have duplicates in the input, the algorithm would be faulty!