help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Subset


From: Andrew Makhorin
Subject: Re: [Help-glpk] Subset
Date: Wed, 19 Oct 2011 16:06:24 +0400

> If you look at the definition of ELEMSET in src/glpmpl.h you will
> see that elemental sets are stored as linked list. Hence access
> via a numeric index would cost O(n) time which is not
> efficient.
> 

ELEMSET is implemented as ARRAY, whose elements have no assigned values.
If an ARRAY is small, a linear search is used. However, if the number of
ARRAY elements becomes greater than 20, the searching routine
automatically builds a binary tree (AVL) to index elements of such
ARRAY, in which case the search time is reduced to O(log n) per one
element.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]