51#ifndef __ADS_SequenceAlgorithms
52 #define __ADS_SequenceAlgorithms
94long search(
const S & s ,
const typename S::Item & v );
117template< Sequence S >
136template< Sequence S >
138 const typename S::Item & v );
160template< Sequence S >
161S
sublist(
const S & s ,
typename S::Pos p ,
typename S::Pos q );
201template< Sequence S >
227template< Sequence S >
255template< Sequence S >
281template< Sequence S >
298template< Sequence S >
309#include "ADS/sequence/impl/SequenceAlgorithms.tpp"
The abstract data types of the book, as concepts of C++20: SEQUENCE, SET and DICTIONARY (chapter 3),...
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The checks of the contracts of the sorts [see Contract.h]: a copy of the input kept only when the aud...
std::size_t lowerBound(const std::vector< T > &A, const T &v, std::size_t lo, std::size_t hi, C less=C())
the first place in of an item not smaller than , if none
Order order(const S &s)
the order of , the most specific that holds
Order
the order of a sequence, the most specific that holds
Definition SequenceAlgorithms.h:168
void bubbleSort(S &s)
the bubble sort: at most passes of swaps of adjacent items out of order, stopped at the first pass w...
void naturalMergeSort(S &s, long *passes=nullptr)
the natural merge sort; the number of passes goes to *passes, if given
long search(const S &s, const typename S::Item &v)
the place of counted from 0, or
S sublist(const S &s, typename S::Pos p, typename S::Pos q)
the sequence of the items of from the position to the position , both included, empty if is
S mergeSorted(const S &a, const S &b)
the merge of the sorted and , the repeated items kept, those of first among equals
void removeDuplicates(S &s)
keeps the first copy of each item, in comparisons
long searchOrdered(const S &s, const typename S::Item &v)
the place of in the sorted , or , the comparisons made, -1 on the empty , so that a miss is always ...
@ NONINCREASING
decreasing, with some equal items
Definition SequenceAlgorithms.h:174
@ CONSTANT
all the items equal
Definition SequenceAlgorithms.h:170
@ NONDECREASING
increasing, with some equal items
Definition SequenceAlgorithms.h:173
@ NONE
neither increasing nor decreasing
Definition SequenceAlgorithms.h:175
@ EMPTY
no item
Definition SequenceAlgorithms.h:169
@ DECREASING
each item smaller than the one before
Definition SequenceAlgorithms.h:172
@ INCREASING
each item larger than the one before
Definition SequenceAlgorithms.h:171