docs/Writerside/topics/collections.md

Sun, 23 Nov 2025 13:15:19 +0100

author
Mike Becker <universe@uap-core.de>
date
Sun, 23 Nov 2025 13:15:19 +0100
changeset 1508
dfc0ddd9571e
parent 1390
ff077f793c5d
permissions
-rw-r--r--

optimize sorted insertion by using the infimum instead of the supremum

The reason is that the supremum returns the equal element with the smallest index, and we want the largest.
Therefore, we use the infimum, which already gives us the largest index when there are equal elements, and increase the index by one. The infimum is also guaranteed to exist in that case.

1141
a06a2d27c043 create new page structure
Mike Becker <universe@uap-core.de>
parents:
diff changeset
1 # Data Structures
1206
6ff6dffcbb08 add intro text for collections API
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
2
1207
543988762f65 fixes accidental typos due to auto-resolution of topic titles
Mike Becker <universe@uap-core.de>
parents: 1206
diff changeset
3 UCX provides a [linked list](linked_list.h.md) and [array list](array_list.h.md) implementation over a common [list](list.h.md) interface,
543988762f65 fixes accidental typos due to auto-resolution of topic titles
Mike Becker <universe@uap-core.de>
parents: 1206
diff changeset
4 as well as a [hash nap](hash_map.h.md) implementation over a [map](map.h.md) interface, and a basic [tree](tree.h.md) implementation.
1206
6ff6dffcbb08 add intro text for collections API
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
5
1390
ff077f793c5d kv-list: add documentation
Mike Becker <universe@uap-core.de>
parents: 1207
diff changeset
6 Another special collection is the [key/value-list](kv_list.h.md) that combines both the list and the map interfaces.
ff077f793c5d kv-list: add documentation
Mike Becker <universe@uap-core.de>
parents: 1207
diff changeset
7
1206
6ff6dffcbb08 add intro text for collections API
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
8 Additionally, UCX provides an abstraction for [iterators](iterator.h.md) that work with all collection types, and
6ff6dffcbb08 add intro text for collections API
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
9 plain C arrays.
6ff6dffcbb08 add intro text for collections API
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
10
1390
ff077f793c5d kv-list: add documentation
Mike Becker <universe@uap-core.de>
parents: 1207
diff changeset
11 The design goal of this API was to provide high-level abstractions (functions in lowerCamelCase) and low-level
1206
6ff6dffcbb08 add intro text for collections API
Mike Becker <universe@uap-core.de>
parents: 1141
diff changeset
12 implementations (functions in snake_case).
1390
ff077f793c5d kv-list: add documentation
Mike Becker <universe@uap-core.de>
parents: 1207
diff changeset
13 This way you can freely choose whether to use the predefined implementations for the various collection types
ff077f793c5d kv-list: add documentation
Mike Becker <universe@uap-core.de>
parents: 1207
diff changeset
14 or to implement your own collections using the low-level API.

mercurial