![](https://img-blog.csdnimg.cn/20200712165746213.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
数据结构与算法
本专栏主要介绍数据结构相关内容,主要包括:树、图、栈、队列、查找、排序等内容。
annjeff
爱编程,爱分享。
展开
-
C++ 迭代与递归方式分别实现二分查找
C++ 迭代与递归方式分别实现二分查找 文章目录C++ 迭代与递归方式分别实现二分查找0.前言1.迭代方式二分查找2.递归方式二分查找 0.前言 查找算法是一种常用算法,查找算法即从给定的数组中,找出要查找的元素第一次出现的位置,如果数组中该元素不存在,返回 -1。 使用二分查找的注意事项: 必须是有序序列才可以使用二分查找。 1.迭代方式二分查找 int binarySearch(std::vector<int>& arr, const int value){ int head原创 2020-07-01 21:50:49 · 280 阅读 · 0 评论 -
线性表顺序存储方式实现
线性表顺序存储方式实现 0. 定义线性表顺序存储结构 #include <stdio.h> #include <stdlib.h> #define MAXSIZE 100 #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 typedef int Status; typedef struct SeqL...原创 2019-09-28 16:45:06 · 623 阅读 · 1 评论 -
栈顺序存储方式实现
栈顺序存储方式实现 @[TOC] ## 0. 栈结构定义 ```c #include "stdio.h" #include "stdlib.h" #define MAXSIZE 20 #define OK 1 #define ERROR 0 #define TRUE 1 #define FALSE 0 typedef int Status; typedef int SElemType; typ...原创 2019-09-29 11:29:42 · 308 阅读 · 0 评论