LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Which algorithm does Sort 1D Array use?

Is it one of those listed in Wikipedia?

 

If not:

  • Is it a constant-memory algorithm for all data types?
  • What is its worst-case complexity?
  • Is it stable?
Message 1 of 6
(3,024 Views)

I believe a version of quicksort is hidden under the hood where we don't play.  

It is not a stable implementation since the entire data becomes the key for complex data types with simillar elements


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 6
(3,006 Views)

Can anyone from NI confirm? I need to know the stability and memory utilization for sure before I put it to use.

0 Kudos
Message 3 of 6
(2,997 Views)

@Staab_Engineering wrote:

Can anyone from NI confirm? I need to know the stability and memory utilization for sure before I put it to use.


I challenge you to write your own that outperforms the stock sort algorithm. 😄

 

Besides, you can easily test it yourself with some simple benchmarks using arrays of various lenght, either random or with some pathological pattern (all the same, all NaN, some NaN, already sorted, reverse sorted, etc.).

 

Things like sorting are very well studied and I am sure that NI put a lot of thought into it. What prompted you to question the sorting algorithm?

0 Kudos
Message 4 of 6
(2,981 Views)

I don't remember challenging the quality of the primitive's implementation; I was just asking for more information about it.

 

One of the most frustrating experiences about posting on the NI forums is that invariably someone, either from NI AE or a community member, will challenge the reason you asked for information or help at all. I want to know the characteristics of the sorting function because I want complete control over the performance of my low-level LabVIEW code. That's reason enough.

Message 5 of 6
(2,967 Views)

@Staab_Engineering wrote:

I don't remember challenging the quality of the primitive's implementation; I was just asking for more information about it.


Well, if you need to sort and the NI implmentation does not fit your needs, you would have to write one yourself. Right?

 

As I said, it would be trivial to write a benchmark testbench geared towards your exact use case (datatype, size, typical patterns, etc.). Why haven't you done that yet?

 


Staab_Engineering wrote:

One of the most frustrating experiences about posting on the NI forums is that invariably someone, either from NI AE or a community member, will challenge the reason you asked for information or help at all. I want to know the characteristics of the sorting function because I want complete control over the performance of my low-level LabVIEW code. That's reason enough.


It is even more frustrating if users fill posts 70% with philosophical comments.

 

You cannot get "complete control", because sorting depends on the input.

 

If NI uses their own algorithm, it is most likely proprietary and they won't tell you the details.

Chances are they are using some known library.

0 Kudos
Message 6 of 6
(2,961 Views)