diff --git a/docs/_sources/libs/sprout/algorithm/index.txt b/docs/_sources/libs/sprout/algorithm/index.txt index 8624ab9d..a222dfd5 100644 --- a/docs/_sources/libs/sprout/algorithm/index.txt +++ b/docs/_sources/libs/sprout/algorithm/index.txt @@ -37,6 +37,8 @@ Sprout.Algorithm upper_bound equal_range binary_search + is_heap + is_heap_until .. _sprout-algorithm-non_modifying: ******************************************************************************* diff --git a/docs/_sources/libs/sprout/algorithm/is_heap.txt b/docs/_sources/libs/sprout/algorithm/is_heap.txt new file mode 100644 index 00000000..e2078848 --- /dev/null +++ b/docs/_sources/libs/sprout/algorithm/is_heap.txt @@ -0,0 +1,46 @@ +.. _sprout-algorithm-is_heap: +############################################################################### +is_heap +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR bool + is_heap(RandomAccessIterator first, RandomAccessIterator last); + + template + inline SPROUT_CONSTEXPR bool + is_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +Returns +======================================== + +| ``is_heap_until(first, last) == last``, ``is_heap_until(first, last, comp) == last`` + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{10, 9, 8, 6, 7, 2, 5, 3, 4, 1}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::is_heap(begin(input), end(input)); + static_assert(result, "input is a heap."); + +Complexity +======================================== + +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/is_heap.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/docs/_sources/libs/sprout/algorithm/is_heap_until.txt b/docs/_sources/libs/sprout/algorithm/is_heap_until.txt new file mode 100644 index 00000000..c0b9b8ef --- /dev/null +++ b/docs/_sources/libs/sprout/algorithm/is_heap_until.txt @@ -0,0 +1,48 @@ +.. _sprout-algorithm-is_heap_until: +############################################################################### +is_heap_until +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR RandomAccessIterator + is_heap_until(RandomAccessIterator first, RandomAccessIterator last); + + template + inline SPROUT_CONSTEXPR RandomAccessIterator + is_heap_until(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +Returns +======================================== + +| If ``distance(first, last) < 2``, returns last. +| Otherwise, returns the last iterator i in [first,last] for which the range [first,i) is a heap. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{10, 9, 8, 6, 7, 2, 5, 13, 14, 11}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::is_heap_until(begin(input), end(input)); + static_assert(result - begin(input) == 7, "input is a heap until position 7."); + +Complexity +======================================== + +| Linear. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/is_heap_until.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/docs/libs/sprout/algorithm/binary_search.html b/docs/libs/sprout/algorithm/binary_search.html index 890fb1c3..8123e4c5 100644 --- a/docs/libs/sprout/algorithm/binary_search.html +++ b/docs/libs/sprout/algorithm/binary_search.html @@ -21,6 +21,7 @@ + @@ -30,6 +31,9 @@
  • index
  • +
  • + next |
  • previous |
  • @@ -123,6 +127,9 @@

    Previous topic

    equal_range

    +

    Next topic

    +

    is_heap

    This Page

    • index
    • +
    • + next |
    • previous |
    • diff --git a/docs/libs/sprout/algorithm/index.html b/docs/libs/sprout/algorithm/index.html index c139dbf2..4d72a2a3 100644 --- a/docs/libs/sprout/algorithm/index.html +++ b/docs/libs/sprout/algorithm/index.html @@ -98,8 +98,8 @@

      Heap operations

      diff --git a/docs/libs/sprout/algorithm/is_heap.html b/docs/libs/sprout/algorithm/is_heap.html new file mode 100644 index 00000000..45766745 --- /dev/null +++ b/docs/libs/sprout/algorithm/is_heap.html @@ -0,0 +1,169 @@ + + + + + + + is_heap — Sprout v1.0 documentation + + + + + + + + + + + + + +
      +
      +
      +
      + +
      +

      is_heap

      +
      +

      Interface

      +
      template<typename RandomAccessIterator>
      +inline SPROUT_CONSTEXPR bool
      +is_heap(RandomAccessIterator first, RandomAccessIterator last);
      +
      +template<typename RandomAccessIterator, typename Compare>
      +inline SPROUT_CONSTEXPR bool
      +is_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
      +
      +
      +
      +
      +

      Returns

      +
      +
      is_heap_until(first, last) == last, is_heap_until(first, last, comp) == last
      +
      +
      +
      +

      Examples

      +
      #include <sprout/algorithm/is_heap.hpp>
      +#include <sprout/array.hpp>
      +#include <sprout/container.hpp>
      +using namespace sprout;
      +
      +SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{10, 9, 8, 6, 7, 2, 5, 3, 4, 1}};
      +SPROUT_STATIC_CONSTEXPR auto result = sprout::is_heap(begin(input), end(input));
      +static_assert(result, "input is a heap.");
      +
      +
      +
      +
      +

      Complexity

      +
      +
      Recursive function invocations in O(logN) (logarithmic) depth.
      +
      +
      + +
      + + +
      +
      +
      +
      +
      +

      Table Of Contents

      + + +

      Previous topic

      +

      binary_search

      +

      Next topic

      +

      is_heap_until

      +

      This Page

      + + + +
      +
      +
      +
      + + + + \ No newline at end of file diff --git a/docs/libs/sprout/algorithm/is_heap_until.html b/docs/libs/sprout/algorithm/is_heap_until.html new file mode 100644 index 00000000..44b7d428 --- /dev/null +++ b/docs/libs/sprout/algorithm/is_heap_until.html @@ -0,0 +1,161 @@ + + + + + + + is_heap_until — Sprout v1.0 documentation + + + + + + + + + + + + +
      +
      +
      +
      + +
      +

      is_heap_until

      +
      +

      Interface

      +
      template<typename RandomAccessIterator>
      +inline SPROUT_CONSTEXPR RandomAccessIterator
      +is_heap_until(RandomAccessIterator first, RandomAccessIterator last);
      +
      +template<typename RandomAccessIterator, typename Compare>
      +inline SPROUT_CONSTEXPR RandomAccessIterator
      +is_heap_until(RandomAccessIterator first, RandomAccessIterator last, Compare comp);
      +
      +
      +
      +
      +

      Returns

      +
      +
      If distance(first, last) < 2, returns last.
      +
      Otherwise, returns the last iterator i in [first,last] for which the range [first,i) is a heap.
      +
      +
      +
      +

      Examples

      +
      #include <sprout/algorithm/is_heap_until.hpp>
      +#include <sprout/array.hpp>
      +#include <sprout/container.hpp>
      +using namespace sprout;
      +
      +SPROUT_STATIC_CONSTEXPR auto input = array<int, 10>{{10, 9, 8, 6, 7, 2, 5, 13, 14, 11}};
      +SPROUT_STATIC_CONSTEXPR auto result = sprout::is_heap_until(begin(input), end(input));
      +static_assert(result - begin(input) == 7, "input is a heap until position 7.");
      +
      +
      +
      +
      +

      Complexity

      +
      +
      Linear.
      +
      Recursive function invocations in O(logN) (logarithmic) depth.
      +
      +
      + +
      + + +
      +
      +
      +
      +
      +

      Table Of Contents

      + + +

      Previous topic

      +

      is_heap

      +

      This Page

      + + + +
      +
      +
      +
      + + + + \ No newline at end of file diff --git a/docs/searchindex.js b/docs/searchindex.js index 70b9ae00..8688ba53 100644 --- a/docs/searchindex.js +++ b/docs/searchindex.js @@ -1 +1 @@ -Search.setIndex({desctypes:{},terms:{logarithm:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],static_s:20,all:[11,33,5,16],distanc:[10,7],set:4,c_arrai:20,less:[9,24,13,16,34],sprout:[0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],random:[10,0,19],greater_equ:14,all_of:[17,16],accompani:19,through:19,binarypred:[0,10,4,13,22,24,35,15],follow:[0,18,35,29,3,4,13,22,24,34,26,15,12,36],pointer:20,find:[17,18,4,13,22,24],find_if:[17,36],is_strictly_increas:[17,28],content:8,onli:[20,31,25,19],inlin:[30,1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],"const":[30,18,29,3,11,5,20,33,23,21,25,24,26],miscellan:2,copyright:[8,19],also:[33,5],front:20,is_sort:[17,28,9,32,14,6],fix:2,binary_search:[17,33],less_equ:28,blog:19,destroi:20,forwarditerator2:[10,22,4,13],exposit:20,requir:[0,3,5,10,33,24,26],under:19,mail:19,subsequ:[22,24,13],is_strictly_decreas:[17,14],arrai:[30,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],match:4,applic:[0,27,18,1,29,10,11,4,21,13,31,22,23,24,34,25,35,15,12,16,36],non:[17,30,24],license_1_0:19,"return":[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],string:2,murakami:19,fals:[0,27,1,10,11,21,31,23,25,16],auto:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],is_sorted_until:[17,6,7],express:[3,33,26,5],clang:19,number:[12,29,19],range_adaptor:2,facebook:19,increas:[28,9],none_of:[17,27],rbegin:20,recurs:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],min_el:17,lexicographical_compar:17,document:[8,19],like:2,specif:2,one_of_equ:[17,25],list:[10,0,35,2],synthes:[2,19],iter:[1,25,3,4,7,10,11,12,13,15,16,0,18,20,21,22,23,24,2,26,27,29,31,33,34,35,36],const_refer:20,mode:19,partit:[3,33,26,5],each:[15,19],pars:[2,19],found:[18,4,13,22,33,24,34,35,15,36],path:19,elem:20,where:[10,15],page:[8,19],compil:[8,19],upper:[26,5],impli:[33,5],find_end:[17,22],version:19,twitter:19,linux:19,some:4,back:20,range_numer:2,minmax:17,see:19,last1:[0,10,4,13,22,35],integ:[22,24,13],domain:2,instal:[8,19],logn:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],any_of_equ:[17,21],make_pair:5,librari:[8,2,19],integr:24,compat:2,index:8,txt:19,slideshar:19,neg:24,brief:19,all_of_equ:[17,11,5],categori:2,inputiterator1:[0,4,35],inputiterator2:[0,35],mathemat:2,const_point:20,sequenc:[17,22,24,13,2],nonempti:15,condit:[0,18,35,29,3,4,13,22,33,24,34,26,15,12,36],size:[20,24,2],boost:19,refer:20,value_typ:20,log2:[3,33,26,5],linear:7,forwarditerator1:[10,22,13],numer:2,comp:[3,5,6,33,7,26],gener:2,contain:[1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,19,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],tristate_lexicographical_compar:17,effect:[22,4,24,13],cbegin:20,constexpr:19,base:19,bitset:2,repositori:19,otherwis:[0,27,1,10,11,21,13,31,23,25,7,16],org:19,decreas:[14,32],modifi:[17,20],valu:[18,29,3,11,4,5,13,22,10,33,23,20,25,21,24,26,15],satisfi:33,search:[17,8,33,13],store:2,last:[1,3,5,6,7,9,11,12,14,15,16,18,21,28,23,24,25,26,27,22,29,31,32,33,34,36],upper_bound:[17,26,5],most:[0,27,18,1,3,11,4,5,13,31,22,33,23,21,34,25,24,26,35,16,36],until:7,equal:[17,0,18,29,10,11,4,5,13,22,23,21,25,24,15],greater:[27,1,31,32,36],static_assert:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],is_heap_until:17,range_algorithm:2,ptrdiff_t:20,implement:20,bolero:19,support:[8,2,19],search_n:[17,24],oper:[17,20],softwar:19,rang:[1,3,4,5,7,10,11,12,13,15,16,0,18,21,22,23,24,25,26,27,29,31,33,34,35,36],compar:[3,5,6,33,7,26],declval:20,adjacent_find:[17,15],modul:8,bound:[3,26,5],forwarditer:[28,14,9,3,5,32,6,33,24,7,26,15],header:[0,1,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],permut:10,empti:[27,1,20,11,4,21,13,31,22,23,25,16],is_permut:[17,10],max_el:17,respect:[3,33,26,5],minmax_el:17,lexicograph:17,inputiter:[27,18,1,29,11,12,21,31,23,34,25,16,36],preprocessor:2,bind2nd:[27,1,12,31,34,16,36],given:[10,0,35],fill:20,would:10,pred:[0,27,1,10,4,13,31,22,24,34,35,15,12,16,36],licens:19,capac:20,construct:20,bool:[0,14,9,1,27,10,11,21,31,32,6,20,33,23,25,28,16],websit:19,start:19,adjac:15,interfac:[30,1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],includ:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],find_first_of:[17,4],second:[35,5],strictli:[14,28],conveni:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],type:[20,24],individu:19,compliant:2,swap:[20,30],"function":[30,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],from:[18,29,4,13,22,24,34,15,12,36],option:2,both:15,namespac:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],tupl:2,copi:[20,19],mismatch:[17,35],metaprogram:2,ani:[1,3,21,13,22,24,26],std:[20,30,12,29],link:19,indic:8,sprout_noexcept_expr:[20,30],iterator_trait:[12,29],first1:[0,10,4,13,22,35],first2:[0,10,4,13,22,35],hold:[0,18,35,29,3,4,13,22,24,34,26,15,12,36],"true":[0,27,1,10,11,21,31,33,23,25,16],than:[27,1,13,31,24,34,16,36],count:[17,12,24,29],none:[27,23],input:[1,3,5,6,7,9,11,12,14,15,16,18,21,28,23,25,26,27,29,31,32,33,34,36],stl:2,hpp:[0,1,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],access:[10,0,20],maximum:17,structur:2,const_reverse_iter:20,project:[8,19],defin:20,sprout_constexpr:[30,1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],minimum:17,below:[10,0,35],cend:20,www:19,crend:20,furthermost:[3,26],meet:[10,0],invoc:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],other:[15,19],arr:30,none_of_equ:[17,23],result:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],point:19,sort:[17,6,7],input1:[0,18,10,4,13,22,24,34,35,36],constant:20,rend:20,give:19,"int":[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],can:19,last2:[0,10,4,13,22,35],argument:[10,0,35],templat:[30,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],rai:[2,19],typedef:20,exist:10,file:19,tabl:8,everi:[0,11,23,27,16],clamp:17,predic:[0,27,18,1,29,10,11,4,21,13,31,22,23,24,34,25,35,15,12,16,36],worst:10,count_if:[17,12],denot:[10,0,35],to_arrai:30,end:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],welcom:[8,19],author:[8,19],odd:12,nonneg:[22,13],depth:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],same:[14,28,9,32],data:[20,2],member:[20,30],binari:[17,33],complex:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],find_if_not:[17,34],modulu:12,which:[18,29,19,12,34,7,35,15,36],lower_bound:[17,3,5],difference_typ:[20,12,29],size_t:[20,30],equal_rang:[17,5],"void":[20,30],sprout_noexcept:20,sprout_static_constexpr:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],begin:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],http:19,distribut:19,trace:[2,19],shall:[3,24,26,5],max:17,"class":[20,30,2],object:2,variant:2,gcc:19,posit:[18,35,3,4,5,13,22,24,34,7,26,15,36],size_typ:20,initi:20,max_siz:20,typenam:[30,1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],pair:[35,5],crbegin:20,comparison:[17,3,33,26,5],const_iter:20,one_of:[17,31],heap:17,remark:[10,0,35],input2:[0,10,4,13,22,35],exactli:[10,12,15,29],lower:[3,5],github:19,is_decreas:[17,32],algorithm:[0,1,2,3,4,5,6,7,9,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],reverse_iter:20,directori:19,min:[17,0,35,15],descript:[20,19],correspond:[0,18,35,29,3,4,13,22,10,33,24,34,26,15,12,36],assign:20,is_heap:17,exampl:[1,3,4,5,6,7,9,10,11,12,13,14,15,16,0,18,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36],thi:19,alphabet:2,is_increas:[17,9],element:[18,29,3,4,5,10,33,20,34,26,15,12,36],first:[1,3,4,5,6,7,9,11,12,13,14,15,16,18,21,28,23,24,25,26,27,29,31,32,33,34,35,36],convert:24,any_of:[17,1]},titles:["equal","any_of","Libraries","lower_bound","find_first_of","equal_range","is_sorted","is_sorted_until","Welcome to Sprout’s documentation!","is_increasing","is_permutation","all_of_equal","count_if","search","is_strictly_decreasing","adjacent_find","all_of","Sprout.Algorithm","find","Sprout C++ Libraries","Class template array","any_of_equal","find_end","none_of_equal","search_n","one_of_equal","upper_bound","none_of","is_strictly_increasing","count","Sprout.Array","one_of","is_decreasing","binary_search","find_if_not","mismatch","find_if"],modules:{},descrefs:{},filenames:["libs/sprout/algorithm/equal","libs/sprout/algorithm/any_of","libs/libraries","libs/sprout/algorithm/lower_bound","libs/sprout/algorithm/find_first_of","libs/sprout/algorithm/equal_range","libs/sprout/algorithm/is_sorted","libs/sprout/algorithm/is_sorted_until","index","libs/sprout/algorithm/is_increasing","libs/sprout/algorithm/is_permutation","libs/sprout/algorithm/all_of_equal","libs/sprout/algorithm/count_if","libs/sprout/algorithm/search","libs/sprout/algorithm/is_strictly_decreasing","libs/sprout/algorithm/adjacent_find","libs/sprout/algorithm/all_of","libs/sprout/algorithm/index","libs/sprout/algorithm/find","libs/index","libs/sprout/array/array/index","libs/sprout/algorithm/any_of_equal","libs/sprout/algorithm/find_end","libs/sprout/algorithm/none_of_equal","libs/sprout/algorithm/search_n","libs/sprout/algorithm/one_of_equal","libs/sprout/algorithm/upper_bound","libs/sprout/algorithm/none_of","libs/sprout/algorithm/is_strictly_increasing","libs/sprout/algorithm/count","libs/sprout/array/index","libs/sprout/algorithm/one_of","libs/sprout/algorithm/is_decreasing","libs/sprout/algorithm/binary_search","libs/sprout/algorithm/find_if_not","libs/sprout/algorithm/mismatch","libs/sprout/algorithm/find_if"]}) \ No newline at end of file +Search.setIndex({desctypes:{},terms:{logarithm:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],static_s:21,all:[12,35,5,17],distanc:[11,28,7],set:4,c_arrai:21,less:[10,25,14,17,36],sprout:[0,1,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],random:[11,0,20],greater_equ:15,all_of:[18,17],accompani:20,through:20,binarypred:[0,11,4,14,23,25,37,16],follow:[0,19,37,31,3,4,14,23,25,36,27,16,13,38],pointer:21,find:[18,19,4,14,23,25],find_if:[18,38],is_strictly_increas:[18,30],content:9,onli:[21,33,26,20],inlin:[32,1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],"const":[32,19,31,3,12,5,21,35,24,22,26,25,27],miscellan:2,copyright:[9,20],also:[35,5],front:21,is_sort:[18,30,10,34,15,6],fix:2,binary_search:[18,35],less_equ:30,blog:20,destroi:21,forwarditerator2:[11,23,4,14],exposit:21,requir:[0,3,5,11,35,25,27],under:20,mail:20,subsequ:[23,25,14],is_strictly_decreas:[18,15],arrai:[32,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],match:4,applic:[0,29,19,1,31,11,12,4,22,14,33,23,24,25,36,26,37,16,13,17,38],non:[18,32,25],license_1_0:20,"return":[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],string:2,murakami:20,fals:[0,29,1,11,12,22,33,24,26,17],auto:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],is_sorted_until:[18,6,7],express:[3,35,27,5],clang:20,number:[13,31,20],range_adaptor:2,facebook:20,increas:[30,10],none_of:[18,29],rbegin:21,recurs:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],min_el:18,lexicographical_compar:18,document:[9,20],like:2,specif:2,one_of_equ:[18,26],list:[11,0,37,2],synthes:[2,20],iter:[1,26,3,4,7,11,12,13,14,16,17,0,19,21,22,23,24,25,2,27,28,29,31,33,35,36,37,38],const_refer:21,mode:20,partit:[3,35,27,5],each:[16,20],pars:[2,20],found:[19,4,14,23,35,25,36,37,16,38],path:20,elem:21,where:[11,16],page:[9,20],compil:[9,20],upper:[27,5],impli:[35,5],find_end:[18,23],version:20,twitter:20,linux:20,some:4,back:21,range_numer:2,minmax:18,see:20,last1:[0,11,4,14,23,37],integ:[23,25,14],domain:2,instal:[9,20],logn:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],any_of_equ:[18,22],make_pair:5,librari:[9,2,20],integr:25,compat:2,index:9,txt:20,slideshar:20,neg:25,brief:20,all_of_equ:[18,12,5],categori:2,inputiterator1:[0,4,37],inputiterator2:[0,37],mathemat:2,const_point:21,sequenc:[18,23,25,14,2],nonempti:16,condit:[0,19,37,31,3,4,14,23,35,25,36,27,16,13,38],size:[21,25,2],boost:20,refer:21,value_typ:21,log2:[3,35,27,5],linear:[28,7],forwarditerator1:[11,23,14],numer:2,comp:[3,5,6,35,7,27,28,8],gener:2,contain:[1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],tristate_lexicographical_compar:18,effect:[23,4,25,14],cbegin:21,constexpr:20,base:20,bitset:2,repositori:20,otherwis:[0,29,1,11,12,22,14,33,24,26,7,28,17],org:20,decreas:[15,34],modifi:[18,21],randomaccessiter:[28,8],valu:[19,31,3,12,4,5,14,23,11,35,24,21,26,22,25,27,16],satisfi:35,search:[18,9,35,14],store:2,last:[1,3,5,6,7,8,10,12,13,15,16,17,19,22,30,24,25,26,27,28,29,23,31,33,34,35,36,38],upper_bound:[18,27,5],most:[0,29,19,1,3,12,4,5,14,33,23,35,24,22,36,26,25,27,37,17,38],until:[28,7],equal:[18,0,19,31,11,12,4,5,14,23,24,22,26,25,16],greater:[29,1,33,34,38],static_assert:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],is_heap_until:[18,28,8],range_algorithm:2,ptrdiff_t:21,implement:21,bolero:20,support:[9,2,20],search_n:[18,25],oper:[18,21],softwar:20,rang:[1,3,4,5,7,11,12,13,14,16,17,0,19,22,23,24,25,26,27,28,29,31,33,35,36,37,38],compar:[3,5,6,35,7,27,28,8],declval:21,adjacent_find:[18,16],modul:9,bound:[3,27,5],forwarditer:[30,15,10,3,5,34,6,35,25,7,27,16],header:[0,1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],permut:11,empti:[29,1,21,12,4,22,14,33,23,24,26,17],is_permut:[18,11],max_el:18,respect:[3,35,27,5],minmax_el:18,lexicograph:18,inputiter:[29,19,1,31,12,13,22,33,24,36,26,17,38],preprocessor:2,bind2nd:[29,1,13,33,36,17,38],given:[11,0,37],fill:21,would:11,pred:[0,29,1,11,4,14,33,23,25,36,37,16,13,17,38],licens:20,capac:21,construct:21,bool:[0,15,10,1,29,11,12,22,33,34,6,21,35,24,26,30,17,8],websit:20,start:20,adjac:16,interfac:[32,1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],includ:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],find_first_of:[18,4],second:[37,5],strictli:[15,30],conveni:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],type:[21,25],individu:20,compliant:2,swap:[21,32],"function":[32,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],from:[19,31,4,14,23,25,36,16,13,38],option:2,both:16,namespac:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],tupl:2,copi:[21,20],mismatch:[18,37],metaprogram:2,ani:[1,3,22,14,23,25,27],std:[21,32,13,31],link:20,indic:9,sprout_noexcept_expr:[21,32],iterator_trait:[13,31],first1:[0,11,4,14,23,37],first2:[0,11,4,14,23,37],hold:[0,19,37,31,3,4,14,23,25,36,27,16,13,38],"true":[0,29,1,11,12,22,33,35,24,26,17],than:[29,1,14,33,25,36,17,38],count:[18,13,25,31],none:[29,24],input:[1,3,5,6,7,8,10,12,13,15,16,17,19,22,30,24,26,27,28,29,31,33,34,35,36,38],stl:2,hpp:[0,1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],access:[11,0,21],maximum:18,structur:2,const_reverse_iter:21,project:[9,20],defin:21,sprout_constexpr:[32,1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],minimum:18,below:[11,0,37],cend:21,www:20,crend:21,furthermost:[3,27],meet:[11,0],invoc:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],other:[16,20],arr:32,none_of_equ:[18,24],result:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],point:20,sort:[18,6,7],input1:[0,19,11,4,14,23,25,36,37,38],constant:21,rend:21,give:20,"int":[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],can:20,last2:[0,11,4,14,23,37],argument:[11,0,37],templat:[32,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],rai:[2,20],typedef:21,exist:11,file:20,tabl:9,everi:[0,12,24,29,17],clamp:18,predic:[0,29,19,1,31,11,12,4,22,14,33,23,24,25,36,26,37,16,13,17,38],worst:11,count_if:[18,13],denot:[11,0,37],to_arrai:32,end:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],welcom:[9,20],author:[9,20],odd:13,nonneg:[23,14],depth:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],same:[15,30,10,34],data:[21,2],member:[21,32],binari:[18,35],complex:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],find_if_not:[18,36],modulu:13,which:[19,31,20,16,13,36,7,37,28,38],lower_bound:[18,3,5],difference_typ:[21,13,31],size_t:[21,32],equal_rang:[18,5],"void":[21,32],sprout_noexcept:21,sprout_static_constexpr:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],begin:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],http:20,distribut:20,trace:[2,20],shall:[3,25,27,5],max:18,"class":[21,32,2],object:2,variant:2,gcc:20,posit:[19,37,3,28,4,5,14,23,25,36,7,27,16,38],size_typ:21,initi:21,max_siz:21,typenam:[32,1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],pair:[37,5],crbegin:21,comparison:[18,3,35,27,5],const_iter:21,one_of:[18,33],heap:[18,28,8],remark:[11,0,37],input2:[0,11,4,14,23,37],exactli:[11,13,16,31],lower:[3,5],github:20,is_decreas:[18,34],algorithm:[0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],reverse_iter:21,directori:20,min:[18,0,37,16],descript:[21,20],correspond:[0,19,37,31,3,4,14,23,11,35,25,36,27,16,13,38],assign:21,is_heap:[18,8],exampl:[1,3,4,5,6,7,8,10,11,12,13,14,15,16,17,0,19,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38],thi:20,alphabet:2,is_increas:[18,10],element:[19,31,3,4,5,11,35,21,36,27,16,13,38],first:[1,3,4,5,6,7,8,10,12,13,14,15,16,17,19,22,30,24,25,26,27,28,29,31,33,34,35,36,37,38],convert:25,any_of:[18,1]},titles:["equal","any_of","Libraries","lower_bound","find_first_of","equal_range","is_sorted","is_sorted_until","is_heap","Welcome to Sprout’s documentation!","is_increasing","is_permutation","all_of_equal","count_if","search","is_strictly_decreasing","adjacent_find","all_of","Sprout.Algorithm","find","Sprout C++ Libraries","Class template array","any_of_equal","find_end","none_of_equal","search_n","one_of_equal","upper_bound","is_heap_until","none_of","is_strictly_increasing","count","Sprout.Array","one_of","is_decreasing","binary_search","find_if_not","mismatch","find_if"],modules:{},descrefs:{},filenames:["libs/sprout/algorithm/equal","libs/sprout/algorithm/any_of","libs/libraries","libs/sprout/algorithm/lower_bound","libs/sprout/algorithm/find_first_of","libs/sprout/algorithm/equal_range","libs/sprout/algorithm/is_sorted","libs/sprout/algorithm/is_sorted_until","libs/sprout/algorithm/is_heap","index","libs/sprout/algorithm/is_increasing","libs/sprout/algorithm/is_permutation","libs/sprout/algorithm/all_of_equal","libs/sprout/algorithm/count_if","libs/sprout/algorithm/search","libs/sprout/algorithm/is_strictly_decreasing","libs/sprout/algorithm/adjacent_find","libs/sprout/algorithm/all_of","libs/sprout/algorithm/index","libs/sprout/algorithm/find","libs/index","libs/sprout/array/array/index","libs/sprout/algorithm/any_of_equal","libs/sprout/algorithm/find_end","libs/sprout/algorithm/none_of_equal","libs/sprout/algorithm/search_n","libs/sprout/algorithm/one_of_equal","libs/sprout/algorithm/upper_bound","libs/sprout/algorithm/is_heap_until","libs/sprout/algorithm/none_of","libs/sprout/algorithm/is_strictly_increasing","libs/sprout/algorithm/count","libs/sprout/array/index","libs/sprout/algorithm/one_of","libs/sprout/algorithm/is_decreasing","libs/sprout/algorithm/binary_search","libs/sprout/algorithm/find_if_not","libs/sprout/algorithm/mismatch","libs/sprout/algorithm/find_if"]}) \ No newline at end of file diff --git a/index.html b/index.html index 553a696d..5e3de8c6 100644 --- a/index.html +++ b/index.html @@ -55,7 +55,7 @@

      Try now!

      Wandbox is an online compiler that you can use the Sprout C++ Libraries.

      -

      Example: Compile-time Inverse FizzBuzz

      +

      Example: Compile-time Inverse FizzBuzz

      Enjoy it!

      Materials

      diff --git a/source/libs/sprout/algorithm/index.rst b/source/libs/sprout/algorithm/index.rst index 8624ab9d..a222dfd5 100644 --- a/source/libs/sprout/algorithm/index.rst +++ b/source/libs/sprout/algorithm/index.rst @@ -37,6 +37,8 @@ Sprout.Algorithm upper_bound equal_range binary_search + is_heap + is_heap_until .. _sprout-algorithm-non_modifying: ******************************************************************************* diff --git a/source/libs/sprout/algorithm/is_heap.rst b/source/libs/sprout/algorithm/is_heap.rst new file mode 100644 index 00000000..e2078848 --- /dev/null +++ b/source/libs/sprout/algorithm/is_heap.rst @@ -0,0 +1,46 @@ +.. _sprout-algorithm-is_heap: +############################################################################### +is_heap +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR bool + is_heap(RandomAccessIterator first, RandomAccessIterator last); + + template + inline SPROUT_CONSTEXPR bool + is_heap(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +Returns +======================================== + +| ``is_heap_until(first, last) == last``, ``is_heap_until(first, last, comp) == last`` + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{10, 9, 8, 6, 7, 2, 5, 3, 4, 1}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::is_heap(begin(input), end(input)); + static_assert(result, "input is a heap."); + +Complexity +======================================== + +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/is_heap.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` + diff --git a/source/libs/sprout/algorithm/is_heap_until.rst b/source/libs/sprout/algorithm/is_heap_until.rst new file mode 100644 index 00000000..c0b9b8ef --- /dev/null +++ b/source/libs/sprout/algorithm/is_heap_until.rst @@ -0,0 +1,48 @@ +.. _sprout-algorithm-is_heap_until: +############################################################################### +is_heap_until +############################################################################### + +Interface +======================================== +.. sourcecode:: c++ + + template + inline SPROUT_CONSTEXPR RandomAccessIterator + is_heap_until(RandomAccessIterator first, RandomAccessIterator last); + + template + inline SPROUT_CONSTEXPR RandomAccessIterator + is_heap_until(RandomAccessIterator first, RandomAccessIterator last, Compare comp); + +Returns +======================================== + +| If ``distance(first, last) < 2``, returns last. +| Otherwise, returns the last iterator i in [first,last] for which the range [first,i) is a heap. + +Examples +======================================== +.. sourcecode:: c++ + + #include + #include + #include + using namespace sprout; + + SPROUT_STATIC_CONSTEXPR auto input = array{{10, 9, 8, 6, 7, 2, 5, 13, 14, 11}}; + SPROUT_STATIC_CONSTEXPR auto result = sprout::is_heap_until(begin(input), end(input)); + static_assert(result - begin(input) == 7, "input is a heap until position 7."); + +Complexity +======================================== + +| Linear. +| Recursive function invocations in *O(logN)* (logarithmic) depth. + +Header +======================================== + +| ``sprout/algorithm/is_heap_until.hpp`` +| Convenience header: ``sprout/algorithm.hpp`` +