![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
hnu999
这个作者很懒,什么都没留下…
展开
-
最大堆及堆排序
最大堆数据结构代码 #include <algorithm> using namespace std; template <typename Item> class MaxHeap { private: Item* items; //存储元素的数组,从索引1开始存储 int count; //最后一个元素索引 int capacity; //容量 //上浮 void shiftUp(int index) { while (true) { i原创 2022-05-17 00:08:13 · 99 阅读 · 0 评论 -
排序算法C++实现整理
1.选择排序 #include <iostream> using namespace std; template<typename T> void selectionSort(T arr[], int n) { for (int i = 0; i < n; i++) { int minIndex = i; for (int j = i+1; j < n; j++) { if (arr[j] < arr[minIndex]) {原创 2022-05-08 21:49:19 · 491 阅读 · 0 评论 -
线性表及实现
概念:由同类型数据元素沟成有序序列的线性结构。 抽象数据类型描述 类型名称:线性表(List) 数据对象集:n个元素构成的有序序列(a1,a2,a3,…,an) 操作: List MakeEmpty()–构造一个空的线性表 ElementType FindKth(int k, List L)–查找k位置的元素 int Find(ElementType X,List L)–查找元素X在线性表L中第一次出现的位置 void Insert(ElementType X, int i, List L)–在i位置前插原创 2022-05-02 00:01:20 · 202 阅读 · 0 评论