文件名称:Statistics
介绍说明--下载内容均来自于网络,请自行研究使用
统计逆序对,设a[0…n-1]是一个包含n个数的数组,若在i<j的情况下,有a[i]>a[j],则称(i, j)为a数组的一个逆序对(inversion)。
比如 <2,3,8,6,1> 有5个逆序对。
请考虑一个最坏情况O(nlogn)的算法确定n个元素的逆序对数目。
注意此题请勿用O(n^2)的简单枚举去实现。
并思考如下问题:
(1)怎样的数组含有最多的逆序对?最多的又是多少个呢?
(2)插入排序的运行时间和数组中逆序对的个数有关系吗?什么关系?-Statistical reverse pair, set a [0 ... n-1] is an array that contains the number n, if the i <j的情况下,有a[i]> a [j], called (i, j) is a array of a reverse pair (inversion). Such as < 2,3,8,6,1> has 5 reverse pairs. Consider a worst-case O (nlogn) algorithm to determine the n number of elements on the reverse. Note that this problem Do not use O (n ^ 2) to achieve a simple enumeration. And consider the following questions: (1) how the array contains the most reverse of its? Most is how many do? (2) the running time of insertion sort an array in reverse order and the number on the relationship you have? What is the relationship?
比如 <2,3,8,6,1> 有5个逆序对。
请考虑一个最坏情况O(nlogn)的算法确定n个元素的逆序对数目。
注意此题请勿用O(n^2)的简单枚举去实现。
并思考如下问题:
(1)怎样的数组含有最多的逆序对?最多的又是多少个呢?
(2)插入排序的运行时间和数组中逆序对的个数有关系吗?什么关系?-Statistical reverse pair, set a [0 ... n-1] is an array that contains the number n, if the i <j的情况下,有a[i]> a [j], called (i, j) is a array of a reverse pair (inversion). Such as < 2,3,8,6,1> has 5 reverse pairs. Consider a worst-case O (nlogn) algorithm to determine the n number of elements on the reverse. Note that this problem Do not use O (n ^ 2) to achieve a simple enumeration. And consider the following questions: (1) how the array contains the most reverse of its? Most is how many do? (2) the running time of insertion sort an array in reverse order and the number on the relationship you have? What is the relationship?
(系统自动生成,下载前可以参看下载内容)
下载文件列表
统计逆序对\tongjinixudui\bin\Debug\tongjinixudui.exe
..........\.............\main.c
..........\.............\obj\Debug\main.o
..........\.............\tongjinixudui.cbp
..........\.............\tongjinixudui.depend
..........\.............\tongjinixudui.layout
..........\.............\bin\Debug
..........\.............\obj\Debug
..........\.............\bin
..........\.............\obj
..........\tongjinixudui
统计逆序对