1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/datatypes/README.md

33 lines
888 B
Markdown
Raw Normal View History

2021-12-23 19:57:15 +03:00
# datatypes
2021-12-23 19:57:15 +03:00
This module provides implementations of less frequently used, but still common
data types.
2021-12-23 19:57:15 +03:00
V's `builtin` module is imported implicitly, and has implementations for arrays,
maps and strings. These are good for many applications, but there are a plethora
of other useful data structures/containers, like linked lists, priority queues,
2023-06-02 10:56:22 +03:00
trees, etc, that allow for algorithms with different time complexities, which may
2021-12-23 19:57:15 +03:00
be more suitable for your specific application.
It is implemented using generics, that you have to specialise for the type of
your actual elements. For example:
```v
2021-12-26 17:01:36 +03:00
import datatypes
2021-12-23 19:57:15 +03:00
mut stack := datatypes.Stack[int]{}
2021-12-23 19:57:15 +03:00
stack.push(1)
println(stack)
```
## Currently Implemented Datatypes:
2021-12-23 19:23:04 +03:00
- [x] Linked list
- [x] Doubly linked list
2021-12-23 19:57:15 +03:00
- [x] Stack (LIFO)
- [x] Queue (FIFO)
- [x] Min heap (priority queue)
- [x] Set
- [x] Quadtree
2023-06-02 10:56:22 +03:00
- [x] Bloom filter
- [ ] ...