Mescal
|
Implementation of dequeues of unsigned integers. More...
Go to the source code of this file.
Classes | |
struct | dequeue |
Type used to represent a dequeue of unsigned integers. More... | |
Functions | |
dequeue * | create_dequeue (void) |
Creation of an empty dequeue. | |
void | delete_dequeue (dequeue *) |
Release of a dequeue. | |
uint | size_dequeue (dequeue *) |
Computes the size of a dequeue. | |
bool | isempty_dequeue (dequeue *) |
Tests whether a dequeue is empty. | |
void | makeempty_dequeue (dequeue *) |
Empties a dequeue. | |
void | lefins_dequeue (uint, dequeue *) |
Inserts a new value on the left of a dequeue. | |
void | rigins_dequeue (uint, dequeue *) |
Inserts a new value on the right of a dequeue. | |
uint | lefread_dequeue (dequeue *, uint) |
Read a value inside a dequeue without removing it (left-right version). | |
uint | rigread_dequeue (dequeue *, uint) |
Read a value inside a dequeue without removing it (right-left version). | |
uint | lefpull_dequeue (dequeue *) |
Removes the leftmost value of a dequeue. | |
uint | rigpull_dequeue (dequeue *) |
Removes the rightmost value of a dequeue. | |
void | copy_dequeue_right (dequeue *, dequeue *, uint) |
Copies all elements in a dequeue to the right of another dequeue. Shifts all values by an input number. | |
bool | mem_dequeue (uint, dequeue *) |
Tests if a value occurs inside a dequeue. | |
void | print_dequeue (dequeue *) |
Displays a dequeue on the standard output. | |
void | sort_dequeue_norepeat (dequeue *) |
Sorts a dequeue in increasing order and keeps only a single copy of each occuring value. | |
bool | mem_dequeue_sorted (uint, dequeue *, uint *) |
Tests if a value occurs inside a sorted dequeue with no repetition. | |
void | merge_sorted_dequeue (dequeue *, dequeue *) |
Merge of two sorted dequeues with no repetitions. | |
dequeue * | make_inter_sorted_dequeue (dequeue *, dequeue *) |
Intersection of two sorted dequeues with no repetitions. | |
dequeue * | make_inter_sorted_dequeue_array (dequeue *p, uint *arr, uint size) |
bool | intersec_dequeue (dequeue *, dequeue *) |
Tests if two sorted dequeues with no repetitions have a nonempty intersection. | |
void | insert_dequeue (dequeue *, uint) |
Inserts a new value inside a sorted dequeue with no repetitions. | |
dequeue * | dequeue_to_indices (dequeue *, dequeue *) |
Takes two dequeues sorted in increasing order with no repetition as input such that the first one is a subset of the second one. Computes the list of indices at which elements of the first dequeue occur in the second one. | |
void | merge_array_sorted_dequeue (dequeue *, dequeue **, uint) |
Merges all dequeues in the array (all of them sorted with no repetitions) into a single dequeue (which is assumed to be empty). | |
Implementation of dequeues of unsigned integers.
Copies all elements in a dequeue to the right of another dequeue. Shifts all values by an input number.
incopy | The dequeue inside which the values are copied. |
tocopy | The dequeue being copied. |
lag | The shift to apply. |
dequeue * create_dequeue | ( | void | ) |
Creation of an empty dequeue.
void delete_dequeue | ( | dequeue * | p | ) |
Release of a dequeue.
p | The dequeue. |
Takes two dequeues sorted in increasing order with no repetition as input such that the first one is a subset of the second one. Computes the list of indices at which elements of the first dequeue occur in the second one.
main | The first dequeue (included in the second one). |
sub | The second dequeue. |
void insert_dequeue | ( | dequeue * | p1, |
uint | q ) |
Inserts a new value inside a sorted dequeue with no repetitions.
p1 | The dequeue. |
q | The value. |
Tests if two sorted dequeues with no repetitions have a nonempty intersection.
p1 | The first dequeue. |
p2 | The second dequeue. |
bool isempty_dequeue | ( | dequeue * | p | ) |
Tests whether a dequeue is empty.
p | The dequeue. |
void lefins_dequeue | ( | uint | val, |
dequeue * | p ) |
Inserts a new value on the left of a dequeue.
val | The value. |
p | The dequeue. |
uint lefpull_dequeue | ( | dequeue * | p | ) |
Removes the leftmost value of a dequeue.
p | The dequeue. |
uint lefread_dequeue | ( | dequeue * | p, |
uint | i ) |
Read a value inside a dequeue without removing it (left-right version).
p | The dequeue. |
i | The index of the value. |
Intersection of two sorted dequeues with no repetitions.
p1 | The first dequeue. |
p2 | The second dequeue. |
void makeempty_dequeue | ( | dequeue * | p | ) |
Empties a dequeue.
p | The dequeue. |
bool mem_dequeue | ( | uint | e, |
dequeue * | p ) |
Tests if a value occurs inside a dequeue.
e | The value. |
p | The dequeue. |
bool mem_dequeue_sorted | ( | uint | e, |
dequeue * | p, | ||
uint * | ind ) |
Tests if a value occurs inside a sorted dequeue with no repetition.
e | The value. |
p | The dequeue. |
ind | Returns the index at which the value occurs (from the left). |
Merges all dequeues in the array (all of them sorted with no repetitions) into a single dequeue (which is assumed to be empty).
out | The dequeue inside which the merge is done. |
array | The array containing the dequques to merge |
size | The size of the array. |
Merge of two sorted dequeues with no repetitions.
p1 | The first dequeue (modified) |
p2 | The second dequeue. |
void print_dequeue | ( | dequeue * | p | ) |
Displays a dequeue on the standard output.
p | The dequeue. |
void rigins_dequeue | ( | uint | val, |
dequeue * | p ) |
Inserts a new value on the right of a dequeue.
val | The value. |
p | The dequeue. |
uint rigpull_dequeue | ( | dequeue * | p | ) |
Removes the rightmost value of a dequeue.
p | The dequeue. |
uint rigread_dequeue | ( | dequeue * | p, |
uint | i ) |
Read a value inside a dequeue without removing it (right-left version).
p | The dequeue. |
i | The index of the value. |
uint size_dequeue | ( | dequeue * | p | ) |
Computes the size of a dequeue.
p | The dequeue. |
void sort_dequeue_norepeat | ( | dequeue * | p | ) |
Sorts a dequeue in increasing order and keeps only a single copy of each occuring value.
p | The dequeue. |