![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构与算法
Mirror_Left
这个作者很懒,什么都没留下…
展开
-
算法题中常用的C++功能
);//小顶堆定义一个空的。原创 2024-07-03 20:17:57 · 908 阅读 · 0 评论 -
二叉树的层序遍历
层序遍历原创 2022-10-16 21:57:28 · 180 阅读 · 1 评论 -
二叉树的前中后序遍历(利用栈实现迭代法)
利用栈实现二叉树的迭代遍历原创 2022-10-16 21:29:42 · 168 阅读 · 0 评论 -
递归实现排列组合(C语言)
利用递归实现排列组合原创 2022-10-09 08:00:00 · 1927 阅读 · 0 评论 -
图(Graph)的基础操作(C++)
#include<stdio.h>#include<queue>#include<stack>#include<stdlib.h>using namespace std;typedef char VertexType;//顶点类型typedef int EdgeType;//边的权重#define MAXVEX 100//最大顶点数#define INFINITY 65535//代表无穷 #define MAXEDGE 1000typ...原创 2022-02-08 15:37:01 · 2568 阅读 · 0 评论 -
后缀表达式的运算(C语言)
#include<stdio.h>#include<stack>using namespace std;stack<int> s;//考虑多位数字 空格分割 int main(){ char str[100]={"2 3 * 5 4 * + 9 -"}; int i=0; int flag=0,temp=0; for(;str[i];i++) { if(str[i]=='+'||str[i]=='-'||str[i]=='*'||str[i]=.原创 2022-01-22 20:35:05 · 348 阅读 · 1 评论 -
最大堆的相关操作(C++)
//最大堆的相关操作 (以数组形式储存的最大堆 #include<stdio.h>#include<stdlib.h>using namespace std;typedef struct Heap{ int *data; int size; int capacity;}*MaxHeap,Heap;MaxHeap Create(int MaxSize)//最大堆的创建 { MaxHeap H=(MaxHeap)malloc(sizeof(Heap)); H.原创 2022-02-05 11:11:53 · 638 阅读 · 0 评论 -
二叉搜索树(BinarySearchTree)相关操作(C++)
#include<stdio.h>#include<stdlib.h>#include<queue>#include<iostream>using namespace std;typedef struct node{ int val; node* left; node* right;}node;node* Create(int val){ node* temp=NULL; temp=(node*)malloc(sizeof(no.原创 2022-01-31 15:39:41 · 754 阅读 · 0 评论 -
后缀表达式求值和转换(C++)
中缀转后缀#include<stdio.h>#include<stack>using namespace std;stack<int> s;int compare(char str,char top)// 如果当前运算符优先级低于栈顶运算符,则需要pop,返回1 { int flag=0; if(str=='+'||str=='-') { if(top!='(')flag=1; } else if(str=='*'||str=='/') {原创 2022-01-26 11:32:25 · 134 阅读 · 0 评论