Startseite › Datentypen › H-Lib-Container Hilfe zum PBXB64-Compiler

H-Lib Union-Find (Disjoint Set)

A union-find (disjoint-set) structure over LONG elements with near-constant-time union and find operations.

Kategorie: H-Lib-Container | Zertifizierung: [ZERTIFIZIERT GETESTET]

Beschreibung

A union-find (disjoint-set) structure over LONG elements with near-constant-time union and find operations.

Kind: Container | Category: H-Lib Native Containers

PBXB64 Status: AVAILABLE

PBXB64 Certification: [CERTIFIED TESTED]

Description

This H-Lib container is implemented in native C support code and exposed through PBXB64 BASIC container syntax. The examples below are focused usage patterns; keep handles valid, release each container with its Final method, and check counts or return values when a method can fail.

Methods

MethodSignatureReturnsDescription
Newuf.NewLNUNIONFINDAllocate a new empty union-find.
Finaluf.FinalnoneFree the union-find.
Validateuf.ValidateLONGNon-zero if the handle is valid.
Clearuf.ClearnoneRemove all elements.
Countuf.CountLONGNumber of elements.
MakeSetuf.MakeSet xnoneAdd a new singleton set for x.
Finduf.Find xQUADReturn the representative of x (0 if unknown).
Unionuf.Union x, yLONGNon-zero if the union changed anything.
SameSetuf.SameSet x, yLONGNon-zero if x and y are in the same set.
Emptyuf.EmptyLONGNon-zero if the union-find is empty.
Componentsuf.ComponentsLONGNumber of disjoint sets.

Validation Evidence

Validation evidence: H-Lib container behavior is exercised by registered BASIC container validation programs and the embedded H-Lib object set used by the single-EXE validation gate.

PBXB64-Prüfung

Diese Referenzseite soll durch ein fokussiertes Compile- oder Laufzeitbeispiel belegt sein. Das Beispiel soll Eingaben, erwartete Ausgabe oder Exit-Code und erforderliche Windows-Ressourcen oder Include-Dateien nennen.

Übersichtshinweise

Allgemeine Übersichtsseiten sollten trotzdem sagen, welche Familie gemeint ist, welche konkreten Befehlsseiten die Implementierung tragen und welche Formen nur der Navigation dienen. So bleibt die Seite detailliert genug, ohne so zu tun, als wäre sie eine vollständige Befehlsreferenz.

Beispiel

LOCAL uf AS LNUNIONFIND
uf = uf.New
uf.MakeSet 1
uf.MakeSet 2
uf.Union 1, 2
PRINT uf.SameSet(1, 2) ' non-zero
uf.Final