1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00
v/vlib/datatypes
2022-10-18 18:02:44 +03:00
..
fsm all: wrap up unsafe { nil } (p. 3) 2022-07-21 21:01:30 +03:00
bstree_test.v datatypes: fix bst child access, when .root is 0 (#14080) 2022-04-20 16:49:18 +03:00
bstree.v checker: unsafe 0 for references (default value) 2022-06-26 06:40:40 +03:00
doubly_linked_list_test.v datatypes: add a forward iterator for LinkedList<T>, add forward and backward iterators for DoublyLinkedList<T>. Add tests for both. 2022-09-23 22:29:13 +03:00
doubly_linked_list.v datatypes: add a forward iterator for LinkedList<T>, add forward and backward iterators for DoublyLinkedList<T>. Add tests for both. 2022-09-23 22:29:13 +03:00
heap_test.v fmt: remove space in front of ? and ! (#14366) 2022-05-13 06:56:21 +03:00
heap.v vlib: rename adt to datatypes 2021-12-26 16:01:36 +02:00
linked_list_test.v datatypes: add a forward iterator for LinkedList<T>, add forward and backward iterators for DoublyLinkedList<T>. Add tests for both. 2022-09-23 22:29:13 +03:00
linked_list.v datatypes: add a forward iterator for LinkedList<T>, add forward and backward iterators for DoublyLinkedList<T>. Add tests for both. 2022-09-23 22:29:13 +03:00
quadtree_test.v datatypes: add quadtree, add its demo to examples/ (#16087) 2022-10-18 18:02:44 +03:00
quadtree.v datatypes: add quadtree, add its demo to examples/ (#16087) 2022-10-18 18:02:44 +03:00
queue_test.v datatypes: add array() method for LinkedList, DoublyLinkedList, Queue, and Stack (#15524) (#15525) 2022-08-25 14:12:39 +03:00
queue.v datatypes: add array() method for LinkedList, DoublyLinkedList, Queue, and Stack (#15524) (#15525) 2022-08-25 14:12:39 +03:00
README.md datatypes: add quadtree, add its demo to examples/ (#16087) 2022-10-18 18:02:44 +03:00
ringbuffer_test.v datatypes: adding ringbuffer (#15818) 2022-09-21 19:42:59 +03:00
ringbuffer.v datatypes: adding ringbuffer (#15818) 2022-09-21 19:42:59 +03:00
set_test.v datatypes: use generic op overloading for difference and equal (#15530) 2022-08-26 07:03:23 +03:00
set.v datatypes: use generic op overloading for difference and equal (#15530) 2022-08-26 07:03:23 +03:00
stack_test.v datatypes: add array() method for LinkedList, DoublyLinkedList, Queue, and Stack (#15524) (#15525) 2022-08-25 14:12:39 +03:00
stack.v datatypes: add array() method for LinkedList, DoublyLinkedList, Queue, and Stack (#15524) (#15525) 2022-08-25 14:12:39 +03:00

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
  • Quadtree
  • ...