zoukankan      html  css  js  c++  java
  • 有序向量:插值查找 Interpolation Search

     尽量少用数学,可以进行估算。适合处理比较大的规模。

    使用插值查找将大规模转变为中小规模的序列,然后在使用排序查找算法或二分查找算法对中小规模的序列进行查找。

    最坏的时间复杂度 : O(n); 

    最好的时间复杂度: O(1);

    平均的时间复杂度: O(loglogn);

    bubble

    Try the following algorithm to sort V={19, 17, 23}: 试用以下算法对V={19, 17, 23}排序:

    1. Sort by units at first 1. 先按个位排序

    2. On the basis of the previous step, sort again by tens 2. 在上一步基础上,再按十位排序

    Is this algorithm correct? 这个算法的是否正确?

    A

    Certainly correct 一定正确

    B

    Certainly incorrect 一定不正确

    C

    If the sorting algorithm used in step 2 is stable, then correct 若第2步用的排序算法是稳定的,则正确

    D

    If the sorting algorithm used in step 1 is stable, then correct 若第1步用的排序算法是稳定的,则正确

    If step 2 is not stable, the possible situation is: {19, 17, 23} -> {23, 17, 19} -> {19, 17, 23}

    The above algorithm is called “radix sort” and is applicable to the case where the sorted element can be divided into several domains. Its correctness depends on the stability when sorting each domain separately.若第2步不稳定,可能的情况是:{19, 17, 23} -> {23, 17, 19} -> {19, 17, 23}

    以上算法称为“基数排序(radix sort)“,适用于被排序元素可分为若干个域的情况,它的正确性要依赖于对每个域分别排序时的稳定性

    基数排序(radix sorting);通过将待排序数组元素分配到有限个有序的桶中,然后分别在每个桶内排序,最后按顺序从桶中取出数据放回数组完成排序。

  • 相关阅读:
    互联网预言大神:凯文·凯利——预测未来的12个趋势
    仅有算法远远不够:AI突破下一站,需要对硬件重新审视
    软件开发中经常使用的5种设计模式
    强化学习到底是什么,它如何运作?
    2020年网络安全的六大经验教训
    选择困难终结者:不同问题之下的机器学习算法
    为什么物联网如此重要?
    Pku3080 Blue Jeans
    pku1734 Musical Theme
    [Usaco2006 Dec]Milk Patterns
  • 原文地址:https://www.cnblogs.com/WLCYSYS/p/14179901.html
Copyright © 2011-2022 走看看