搜索资源列表
algorithms-master
- 1. 经典的算法实现 2. 服务器端 3. 正确,易于使用和改造, 一个头文件一个算法,并附带一个demo. 1. 一个算法用一个.h文件表示放到include下.2. 算法演示的demo程序放到src下.3. 程序正确通过后,请发起Pull Requests,代码被验证后入库,并在README中发布新算法实现。 已实现 ( Implemented ): Array shuffle Prime test(trial division) Prime test(Mi
HEAPSORT-IMPLEMENTATION.cpp
- 定义一个数组,初始化为空。在数组上执行两种操作: 1、增添1个元素,把1个新的元素放入数组。 2、输出并删除数组中最小的数。 使用堆结构实现上述功能的高效算法。-The definition of an array is initialized to empty. Performed on the array of two things: 1, adding an element to a new element into the array. 2, and removes the
main
- 1)实现二路归并排序算法。 2)实现快速排序算法。 3)实现堆排序算法。 4)实现冒泡排序和选择排序算法 (2).已知长度为n的线性表A采用顺序存储结构,请写一时间复杂度为0(n)、空间复杂度为0(1)的算法,该算法删除线性表中所有值为item的数据元素。要求:线性表元素个数n很大,而值为item的数据元素个数很少,要求移动元素个数尽量少;删除后的数组元素与原数组元素不必保持顺序一致。 (3).编写一个主函数,调试上述算法。注:需要额外设计一个线性表初始化的函数。 (4)
duipaixu
- 通过简单的下沉操作,数组建堆操作最终实现堆排序的C++源代码-Through the simple sinking operation, array build heap operation of the ultimate heap sort of C++ source code
Heapsort
- 堆排序是指利用堆这种数据结构所设计的一种排序算法,它是选择排序的一种。可以利用数组的特点快速定位指定索引的元素。堆分为大根堆和小根堆,是完全二叉树。大根堆的要求是每个节点的值都不大于其父节点的值,即A[PARENT[i]] >= A[i]。在数组的非降序排序中,需要使用的就是大根堆,因为根据大根堆的要求可知,最大的值一定在堆顶。-Heapsort refers to a sorting algorithm data structure designed using the heap, it
Demo
- 数据结构中堆排序的代码实现。堆排序就是首先建立一个小顶堆或是大顶堆,然后把堆中最大的放到数组最后,再建立堆,再放到数组后面的位置-Data structure in the heap sort code. Heap sort is to first establish a small cap pile or pile top, and then put the heap s largest array in the end, to build pile, put them behind the
sort
- 利用堆排序的思想,使用C++模板类,对数组进行排序,输出最大或最小的k个数。-The use of heap sort of thinking, using C++ template class, sort the array, the output of the maximum or minimum number of k.
Dijkstra
- Heaps where the parent key is greater than or equal to (≥) the child keys are called max-heaps those where it is less than or equal to (≤) are called min-heaps. Efficient (logarithmic time) algorithms are known for the two operations needed to implem