![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
迷藏_victor
一万小时定律,我坚信这是世间最棒的规则
展开
-
6-10 二分查找 (20 分)
没啥好说的,直接上代码: Position BinarySearch( List L, ElementType X ){ int low = 1,high = L->Last; while(low <= high){ int mid = (low+high)/2; if (L->Data[mid] == X){ return mid; } else if (L->Data[mi原创 2021-09-02 15:56:30 · 110 阅读 · 0 评论 -
7-1 Maximum Subsequence Sum (25 分)(python实现)
Given a sequence ofKintegers {N1,N2, ...,NK}. A continuous subsequence is defined to be {Ni,Ni+1, ...,Nj} where1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example, given seq...原创 2021-09-02 15:52:33 · 129 阅读 · 0 评论 -
7-1 最大子列和问题 (python实现)
给定K个整数组成的序列{N1,N2, ...,NK},“连续子列”被定义为{Ni,Ni+1, ...,Nj},其中1≤i≤j≤K。“最大子列和”则被定义为所有连续子列元素的和中最大者。例如给定序列{ -2, 11, -4, 13, -5, -2 },其连续子列{ 11, -4, 13 }有最大的和20。现要求你编写程序,计算给定整数序列的最大子列和。 本题旨在测试各种不同的算法在各种数据情况下的表现。各组测试数据特点如下: 数据1:与样例等价,测试基本正确性; 数据2:1...原创 2021-09-02 13:22:14 · 228 阅读 · 0 评论