zoukankan      html  css  js  c++  java
  • 变序性算法

    代码
    reverse(beg,end);
    reverse_copy(sourcebeg,sourceend,destbeg);

    旋转元素次序:
    rotate(beg,newbeg,end);
    将beg
    -end元素旋转,然后newbeg成为第一个元素

    rotate_copy(beg,newbeg,end,destbeg);
    将beg
    -end的元素旋转复制到destbeg里面,并且使newbeg成为第一个元素

    排列元素:
    bool next_permutation(beg,end);
    bool prev_permutation(beg,end);
    改变元素次序,符合下一个排列次序
    改变元素词语,符合上一个排列次序


    重拍元素:
    random_abuffle(beg,end);
    random_abuffle(beg,end,op);
    第一个随机打乱beg
    -end的元素次序
    第二个用op打乱beg
    -end的元素次序

    向前搬移元素:
    partition(begin,end,op);
    stable_partition(beg,end,op);

    排序:

    sort(begin,end);

    sort(begin,end,op);

    stable_sort(beg,end);

    stable_sort(beg,end,op);

    局部排序:

    partial_sort(begin,sortend,end);

    partial_sort(begin,sortend,end,op);

    对begin-end进行排序,使begin-sortend变成有序

    partial_sort_copy(sourcebegin,sourceend,destbeg,destend);

    partial_sort_copy(sourcebegin,sourceend,destbeg,destend,op);

    根据第n个元素排序:

    nth_element(beg,nth,end);

    nth_element(beg,nth,end,op);

    heap排序:

    make_heap(beg,end);

    make_head(beg,end,op);

    push_heap(beg,end);

    push_heap(beg,end,op);

    pop_heap(beg,end);

    pop_heap(beg,end,op);

    sort_heap(beg,end);

    sort_heap(beg,end);

  • 相关阅读:
    vue源码分析—Vue.js 源码目录设计
    vue源码分析—认识 Flow
    在Windows上安装配置MongoDB
    mongoDB概述
    Could not load file or assembly Microsoft.Web.Infrastructure
    配置错误 不能在此路径中使用此配置节(转)
    VS2013快捷键大全
    Create new tool for CSV
    How to get http response.
    C#中Split用法
  • 原文地址:https://www.cnblogs.com/linyilong3/p/1847703.html
Copyright © 2011-2022 走看看