first commit

This commit is contained in:
2021-12-16 21:01:08 +11:00
committed by aaron-jack-manning
commit bba29d0008
20 changed files with 705 additions and 0 deletions

10
lib/queue.mli Normal file
View File

@@ -0,0 +1,10 @@
open Types
(** Adds an element to the back of the queue, returning the new queue. Runs in O(1). *)
val enqueue : 'a -> 'a queue -> 'a queue
(** Removes an element from the front of the queue, returning a tuple of the new queue and an option which is None if the queue is empty, or Some [x] where [x] wa the element on the front of the queue. Runs in best case O(1), worse case O(n) and amortized O(1). *)
val dequeue : 'a queue -> 'a option * 'a queue
(** The empty queue. *)
val empty : 'a queue