![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
艾听先生
假程序员一枚
展开
-
封装顺序栈(模拟实现stack)
一。我们先来看看库函数stack中有哪些函数 我们看到函数有@1.empty()函数:函数原型:bool empty ( ) const;判断栈是佛为NULL;true if the container size is 0, false otherwise.@2.size()函数:函数原型:size_type size ( ) const;返回栈中有用元素个数,size_t类型@3.top原创 2017-12-12 20:24:30 · 328 阅读 · 0 评论 -
封装顺序栈(模拟实现stack)
一。我们先来看看库函数stack中有哪些函数 我们看到函数有@1.empty()函数:函数原型:bool empty ( ) const;判断栈是佛为NULL;true if the container size is 0, false otherwise.@2.size()函数:函数原型:size_type size ( ) const;返回栈中有用元素个数,size_t类型@3.top原创 2017-12-12 20:24:55 · 453 阅读 · 0 评论 -
二分查找算法
二分查找算法是常用的查找算法里面有很多注意的点#include<iostream>using namespace std;#if 0//区间为[)型int BinarySearch(int*array, int size, int data){ int left = 0; int right = size; int m = 0; while (left <原创 2017-12-12 20:59:29 · 199 阅读 · 0 评论 -
二叉树的简单操作
一,定义: 在计算机科学中,二叉树是每个节点最多有两个子树的树结构。通常子树被称作“左子树”(left subtree)和“右子树”(right subtree)。二叉树常被用于实现二叉查找树和二叉堆。二,特点1,二叉树的每个结点至多只有二棵子树(不存在度大于2的结点),。2,二叉树的子树有左右之分,次序不能颠倒。3,二叉树的第i层至多有2^{i-1}个结点;3,深原创 2018-01-07 11:41:30 · 184 阅读 · 0 评论 -
二叉树的进一步学习
一,创建一颗二叉树 BinTree() :Root(NULL) {} void _BinTree(T* str, size_t size, const T& invalid) { size_t index = 0; Root = _Create(str, size, index, invalid); } BinTree(BinTree& bt) { Root=Co原创 2018-01-07 17:20:40 · 159 阅读 · 0 评论 -
走迷宫
迷宫图解程序实现#include<iostream> #include<cstdlib> #define Max_Size 100 using namespace std;enum Direcation{ Up = 1, Down = 2, Left = 3, Right = 4};typedef struct{ int x, y;}C...原创 2018-03-11 11:01:30 · 560 阅读 · 0 评论 -
简单栈的应用之括号匹配
常常我们在写程序时,编译代码能发现我们括号匹配正确与否,今天我们模拟实现一个简单的括号匹配函数,用以复习栈的引用#include<iostream>#include<stack>using namespace std;bool is_Brackets(char ch){ if (ch == '(' || ch == ')' || ch == '[' || ch == ']' ||原创 2017-12-13 21:19:21 · 571 阅读 · 1 评论