-
sijielonggekutafa
四阶龙格库塔法 数值计算 C++源码 可直接运行(Fourth-order Runge-Kutta numerical method C++ source code can be run directly)
- 2015-10-28 19:59:24下载
- 积分: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
-
基于AOA的室外雷达定位算法仿真 EKF
说明: 基于AOA的室外雷达定位算法仿真,基于TDOA的室外雷达定位算法仿真,基于AOA doa的室外雷达定位算法仿真,三维(Simulation of outdoor radar location algorithm based on AOA, simulation of outdoor radar location algorithm based on TDOA, simulation of outdoor radar location algorithm based on AOA TDOA, 3d)
- 2019-05-16 09:50:00下载
- 积分:1
-
EEHMT0
根据给定的等距结点上的函数值与一阶导数值, 用埃尔米特等距插值公式计算指定插值点处的函数值。(According to the given equidistant nodes function value with a first derivative values, with equidistant interpolation Hermite interpolation formula specified function value at the point.)
- 2013-08-26 15:12:11下载
- 积分:1
-
gps_position
GPS卡尔曼滤波仿真
read eph_data (GPS Kalman filter simulation read eph_data)
- 2009-07-14 16:53:01下载
- 积分:1
-
turbulence
计算流体动力学中湍流模型的源程序,代码十分宝贵(Computational fluid dynamics model of the source of turbulence, the code is very valuable)
- 2021-01-02 15:08:57下载
- 积分:1
-
FiniteElementMethod
有限元方法与C程序设计
介绍有限元方法原理和如何设计C程序,书后有相关代码。(Finite element method with the C programming)
- 2010-01-01 16:10:54下载
- 积分:1
-
FFP
计算水声传播的快速场(FFP)程序,基于传播矩阵,迭代和快速傅里叶变换方法。(underwater acoustic field computing Fast FIELD Program, based on TMM, FFT etc.)
- 2021-03-19 20:29:19下载
- 积分:1
-
2阶方程最小二乘法
说明: 最小二乘法估算三元二阶方程式系数,用于抛物线曲线拟合(Estimating coefficient of second order equation by least square method)
- 2020-03-24 16:26:04下载
- 积分:1
-
matlab-solve-the-parabolic-equations
matlab求解抛物方程源程序,包括真值、近似值与误差,最大误差随网格数变化(matlab solve the parabolic equations)
- 2012-11-27 12:04:01下载
- 积分:1