Akronix Akronix - 1 month ago 21
Pascal Question

What is the implementation of sets used in pascal?

I want to know the actual implementation of the set type in pascal, provided by the language. Specially, I would like to know the one used in the freepascal runtime library, but I'm interested in any pascal implementation.

I care about the run-time complexity of it. The best implementations of Disjoint-set data structure are in O(log*n), and I wish to know if pascal implementation has this one.

The doc for the fpc rtl is found here: ftp://ftp.freepascal.org/pub/fpc/docs-pdf/rtl.pdf , but it's too large (>1700 pages) for looking for this without knowing if it's even there. The freepascal wiki doesn't shed any light on this.

Answer

According to this explanation, Pascal internally represents sets as bit strings. However, the article apparently does not refer to a specific implementation of Pascal. In this documentation, it is also stated that bitstrings are used for representation. More precisely, this documentation explicitly mentions 32 bytes for storage of a set.