
数据结构算法
Turing·
不积小流无以成江海
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
二叉查找树实现
二叉查找树的API实现原创 2022-06-02 15:23:08 · 568 阅读 · 0 评论 -
数据结构~目录(待续)
目录 1.哈希表 2.树 二叉树(Binary Tree) 二叉排序树(Binary Sort Tree,BST) 哈夫曼二叉树(Huffman) 字典树(Trie) 3.优先队列(Priority Queue) 二叉堆 可并堆 左偏树(Leftist Tree) 并查集(Union Find Set)朋友圈 线段树 1.哈希表 优点: 把数据存储和查找所消耗的时间大...原创 2019-12-31 17:22:24 · 530 阅读 · 0 评论 -
树状数组
#include"iostream" using namespace std; int NUM = 100; int tree[101]; void update(int index,int n){ for(int i=index;i<=NUM;i+=(i&(-i))){ //lowbit函数 i&(-i) 求从右到左第一个1,分割数,求的是距离...原创 2019-12-30 17:09:35 · 95 阅读 · 0 评论 -
约瑟夫问题
我的代码 #include"iostream" using namespace std; //约瑟夫问题 int a[10] = {0}; int j = 1; int i = 0; int k = 1; int main(){ while(1){ if(a[i]==0){ if(j==3){ j=0; a[i] = k; k++; if...原创 2019-12-25 17:06:09 · 91 阅读 · 0 评论 -
输入先序和中序,输出后序遍历结果
#include"iostream" #include"math.h" #include<bits/stdc++.h> using namespace std; //输入先序和中序,输出后序遍历结果 char s1[100]={'a','b','d','e','c'}; char s2[100]={'d','b','e','a','c'}; int posi(char ch...原创 2019-12-25 14:19:11 · 815 阅读 · 0 评论 -
Tree(c++)
#include"iostream" using namespace std; struct node{ int data; node *childl; node *childr; node *parent; }Node; node* add(int num){ node *tree = new node; tree->data = num; tree->chi...原创 2019-12-24 23:06:15 · 535 阅读 · 0 评论 -
HashTable
开地址法 #include"iostream" using namespace std; int hkey(int key){ return key%13; } void ikey(int b[],int key,int a){ if(key<13){ if(b[key+1]==0){ b[key+1] = a; }else{ ikey(b,key+1,a); }...原创 2019-12-24 19:21:47 · 121 阅读 · 0 评论