LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Organization of Variant Attributes

Solved!
Go to solution

@CoastalMaineBird wrote:

 

Then the attributes are stored  as variants themselves.  They're already sorted, so it's the insertion process which sorts them.


Well sort of. The Attributes are really stored in a red-black tree structure with the attribute name as the key and the attribute value as the value in form of another variant. Inserting into a red-black tree inherently sorts the data structure (and redistributes the tree if necessary to make sure the total depth of the tree is only at most one element different between the shortest and longest path to make sure the tree is a balanced binary tree. Red-black trees require a certain amount of work when inserting a new element but are log(N) when looking up an element, which is pretty much the optimum.

And that tree is stored as an extra element (pointer) inside the variant, which can be NULL if there are no attributes. 

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 21 of 21
(416 Views)