v/vlib/datatypes
Vincenzo Palazzo 3d723eb9bf
checker: ban unsafe pointer/fn comparison (#14462)
2022-05-25 12:54:58 +02:00
..
fsm fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
README.md docs: cleanup (#14327) 2022-05-07 20:18:42 +03:00
bstree.v checker: ban unsafe pointer/fn comparison (#14462) 2022-05-25 12:54:58 +02:00
bstree_test.v datatypes: fix bst child access, when .root is 0 (#14080) 2022-04-20 16:49:18 +03:00
doubly_linked_list.v checker: ban unsafe pointer/fn comparison (#14462) 2022-05-25 12:54:58 +02:00
doubly_linked_list_test.v fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
heap.v
heap_test.v fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
linked_list.v checker: ban unsafe pointer/fn comparison (#14462) 2022-05-25 12:54:58 +02:00
linked_list_test.v fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
queue.v datatypes: add an index method on LinkedList and Queue (#13185) 2022-01-16 19:11:10 +02:00
queue_test.v fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
stack.v
stack_test.v fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00

README.md

datatypes

This module provides implementations of less frequently used, but still common data types.

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, tries, etc, that allow for algorithms with different time complexities, which may 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:

import datatypes

mut stack := datatypes.Stack<int>{}
stack.push(1)
println(stack)

Currently Implemented Datatypes:

  • Linked list
  • Doubly linked list
  • Stack (LIFO)
  • Queue (FIFO)
  • Min heap (priority queue)
  • Set
  • ...