-
ASPNETCASE2
有在线论坛,网络硬盘,聊天室的功能实现,用.net,c#(Has an online forum, network hard drive, realize the functions of the chat room with. Net, c#)
- 2008-07-09 17:48:19下载
- 积分:1
-
11087 统计逆序对
说明: Description
设a[0…n-1]是一个包含n个数的数组,若在ia[j],则称(i, j)为a数组的一个逆序对(inversion)。
比如 有5个逆序对。请采用类似“合并排序算法”的分治思路以O(nlogn)的效率来实现逆序对的统计。
一个n个元素序列的逆序对个数由三部分构成:
(1)它的左半部分逆序对的个数,(2)加上右半部分逆序对的个数,(3)再加上左半部分元素大于右半部分元素的数量。
其中前两部分(1)和(2)由递归来实现。要保证算法最后效率O(nlogn),第三部分(3)应该如何实现?
此题请勿采用O(n^2)的简单枚举算法来实现。
并思考如下问题:
(1)怎样的数组含有最多的逆序对?最多的又是多少个呢?
(2)插入排序的运行时间和数组中逆序对的个数有关系吗?什么关系?
输入格式
第一行:n,表示接下来要输入n个元素,n不超过10000。
第二行:n个元素序列。
输出格式
逆序对的个数。
输入样例
5
2 3 8 6 1
输出样例
5(Set a[0... N-1] is a n array containing n numbers. If there is a [i] > a [j] i n the case of I < j, then (i, j) is a n inversion pair of a array.
For example, has five reverse pairs. Please use the idea of "merge sorting algorithm" to achieve the statistics of inverse pairs with O (nlogn) efficiency.
The number of inverse pairs of a sequence of n elements consists of three parts:
(1) The number of reverse pairs in the left half, (2) the number of reverse pairs in the right half, (3) the number of elements in the left half is greater than that in the right half.
The first two parts (1) and (2) are implemented by recursion. To ensure the final efficiency of the algorithm O (nlogn), how should the third part (3) be implemented?
Do not use O (n ^ 2) simple enumeration algorithm to solve this problem.)
- 2019-01-07 23:52:06下载
- 积分:1
-
使Infenen变得简单 DAvE_XC866_v2.3
说明: making infenen easy .you can use it product code such cdd, cpu and adc and so on.
- 2020-06-22 09:00:02下载
- 积分:1
-
C# 西门子PLC ppi通讯程序.rar
【实例简介】
用C#写的西门子S7-200 PLC 的PPI通讯测试程序,可读写I,Q,M,VB等,希望对学习PPI通讯的同学有帮助。
- 2021-12-02 00:44:55下载
- 积分:1
-
文件传输
socket文件传输 一主一从实现远程数据传输功能,其内容包括两个部分,一个是主站程序,一个是从站程序,经过测试,功能是可以实现的,文件在发送前先给压缩,将压缩包传输到从站,从接受文件并解压。
- 2023-03-31 03:50:04下载
- 积分:1
-
TSP
TSP问题(货郎担问题,旅行商问题)的模拟退火算法通用malab源程序
f目标最优值,T最优路线,d距离矩阵,t0初始温度,tf结束温度
- 2010-08-20 21:33:00下载
- 积分:1
-
GPS-wangpingcha
GPS网平差C++程序,包含粗差探测、拟稳平差、已知点加权平差、自由网平差等各种算例(GPS network adjustment C++ procedures, including gross error detection, to be stable adjustment, known point weighting adjustment, free network adjustment, and other examples)
- 2021-04-24 13:28:47下载
- 积分:1
-
Library for iec 104
用于与机器领域和其他电子系统通信的iec104库
- 2022-02-15 05:03:20下载
- 积分:1
-
VC频谱分析 FFT
VC++6.0做的 频谱分析 FFT 能够帮助了解频域信号的处理知识,请大家点赞!不过小遗憾是需要硬件驱动的。没有关系可以看存储的数据,关键是了解算法。请大家多下载观摩。
- 2022-04-30 17:22:48下载
- 积分:1
-
Using C language to achieve the Newton iteration solution line N
用C语言实现的牛顿迭代法解线N阶方程的程序,并附有实验报告-Using C language to achieve the Newton iteration solution line N-order equation of the procedures, together with the experimental report
- 2022-06-21 12:44:42下载
- 积分:1