![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
ccbka
本人是重亲大学仪器科学与技术的研究生,专业方向是图像识别,正在关注的领域是深度学习
展开
-
线性表的顺序存储结构
#include using namespace std; #define LIST_INIT_SIZE 100 #define LISTINCREMENT 10 typedef int Elemtype; typedef struct//定义一个结构体,只是告诉编译器结构体变量内部的布局,并不会生成在实际的代码或内存中 { Elemtype* elem; int length;原创 2017-11-06 22:49:10 · 141 阅读 · 0 评论 -
两个栈实现一个队列
#include #include using namespace std; class solution{ public: void push(int value) { } pop() { } private: stack stack1; stackstack2; }; int solution::pop() { while (!stack1.empty())原创 2017-11-12 18:16:14 · 125 阅读 · 0 评论 -
堆排序(自己版本)
#include #include using namespace std; void heap_adjust(vector& v, int node_bh, int last_node_bh) { if (node_bh { int father = node_bh; int node_need_adjust; bool adjust = false; int left_c原创 2017-11-12 21:17:01 · 164 阅读 · 0 评论 -
二插排序树(自己实现)
#include #include using namespace std; #define Elemtype int typedef struct node { Elemtype data; node* left_node; node* right_node; }node; void insert(node*& root,Elemtype elem)//由一个根节点去递归的生原创 2017-11-12 23:03:40 · 356 阅读 · 0 评论 -
归并排序(自己实现)
#include #include using namespace std; void merge(vector& nums, int l, int mid, int r) { vector left_nums; vector right_nums; for (int i = l; i { left_nums.push_back(nums[i]); } for (int j原创 2017-11-13 13:05:32 · 182 阅读 · 0 评论 -
链表的生长于翻转
#include using namespace std; typedef struct node { int data; node* next; }node; void list_grow(node*& head,int nums[], int len) { node* front=NULL; node* temp=NULL; for (int i = 0; i {原创 2017-11-17 12:03:46 · 157 阅读 · 0 评论 -
变态青蛙跳
class Solution { public: int jumpFloorII(int number) { int re=0; if(number return 0; if(number==1) return 1; else {原创 2017-11-13 18:28:19 · 271 阅读 · 0 评论 -
一个数可以由哪些数相加得到
#include using namespace std; void fj(int n,int qt)//qt记录递归时的嵌套次数 { if (n return; if (n == 1) { cout cout } if (n == 2) { cout cout if (qt>0) qt--; return; } if (n>2) { cout原创 2017-11-14 20:07:45 · 2283 阅读 · 1 评论 -
全排列(自己版本)
#include #include #include using namespace std; void swap(char letters[],int i,int j) { char temp = letters[i]; letters[i] = letters[j]; letters[j] = temp; } void qpl(char letters [], int st原创 2017-11-13 23:01:13 · 210 阅读 · 0 评论 -
最大子序列和
#include #include #include using namespace std; int zdzdh(int* nums,int i) { if (i==0) return nums[i]; else { if (nums[i] + zdzdh(nums, i - 1) return nums[i]; else return zdzdh(nums, i -原创 2017-11-15 14:23:35 · 142 阅读 · 0 评论 -
顺时针打印矩阵
#include using namespace std; void print_circle(int matrix[][4], int circle_num, int len) { for (int i = circle_num - 1; i { cout } for (int i = circle_num-1; i { cout } for (int i = l原创 2017-11-15 20:29:15 · 124 阅读 · 0 评论 -
矩阵顺时针旋转90度
#include #include using namespace std; void rotate_circle(int matrix[][4],int circle_num,int len) { queue temp1; queue temp2; for (int i = circle_num - 1; i { temp1.push(matrix[i][len - circ原创 2017-11-15 21:33:24 · 604 阅读 · 0 评论 -
构建链表及链表翻转
#include using namespace std; #define Elemtype int typedef struct node { int data; node* next; }node; node* generate_list(int*nums,int n)//头结点指向了一个叫做nodee的结点,此时的nodee还是个概念(想象)上的东西,实际上不存在 { n原创 2017-11-12 15:33:19 · 175 阅读 · 0 评论 -
动态线性单链表
#include using namespace std; typedef int Elemtype; typedef struct Lnode//此行的LNode是一个结构标签(名) { Elemtype data; Lnode* next;//因为之前有了Lnode这个结构标签,因此此处可用来声明一个指针变量 }Lnode, *Linklist; //此行的LNode是结构体st原创 2017-11-07 15:08:53 · 206 阅读 · 0 评论 -
静态链表实现A-B(集合相减操作)
#include using namespace std; #define Elemtype int #define MAX_SIZE 100 #include using namespace std; typedef struct { Elemtype data; int cur; }node,nodes[100]; void init_nodes(nodes& node原创 2017-11-07 22:57:59 · 386 阅读 · 0 评论 -
双向链表
#include using namespace std; #define Elemtype int #define INIT_SIZE 10 typedef struct node { Elemtype data; node* prior; node* later; }node,*pnode; pnode init_list() { pnode head; head =原创 2017-11-08 10:11:08 · 143 阅读 · 0 评论 -
顺序栈
#include using namespace std; #define Elemtype unsigned int #define INIT_SIZE 10 #define INCREMENT 10 typedef struct { Elemtype* base; Elemtype* top; unsigned int stacklength; int stacksize;原创 2017-11-08 12:24:16 · 178 阅读 · 0 评论 -
根据二叉树的先序遍历建立二叉树
#include #include //#include using namespace std; #define Elemtype char typedef struct node { Elemtype data; node* left_child; node* right_child; }node,*BST; void build_pre(node*& one_node原创 2017-11-11 14:32:49 · 1390 阅读 · 0 评论 -
根据先序遍历和中序遍历建立二叉树
#include #include #include #include using namespace std; typedef struct node { char data; node* left; node* right; }node; void create_btree(node*& one_node,const char* pre,const char* in,in原创 2017-11-11 17:14:58 · 684 阅读 · 0 评论 -
由先序遍历和中序遍历建立二叉树
#include #include #include #include #include #include using namespace std; typedef int ElemType; typedef struct BinaryTreeNode { ElemType data; BinaryTreeNode *left, *right; }B转载 2017-11-11 17:16:22 · 659 阅读 · 0 评论 -
由前序遍历与中序遍历生成二叉树及二叉树的前序,中序,后续,层序遍历
#include #include #include #include #include using namespace std; typedef struct node { char data; node* left; node* right; }node; void create_btree(node*& one_node,const char* pre,const c原创 2017-11-11 17:41:02 · 259 阅读 · 0 评论 -
自己实现的递归代码
#include using namespace std; void quick_sort(int* nums,int l,int r) { int key_num = nums[(l + r) / 2];//向下取整?? int i = l; int j = r; while (i { while (nums[i] i++; while (nums[j]>key_num原创 2017-11-12 11:42:08 · 235 阅读 · 0 评论 -
自己实现的二分搜索
#include using namespace std; int binary_search(int* nums,int num, int l, int r) { int mid_loc = (l + r) / 2; if (nums[mid_loc] == num) return mid_loc; else if (nums[mid_loc] > num) binary_sea原创 2017-11-12 12:12:43 · 253 阅读 · 0 评论 -
旋转数组中的最小值(二分搜索实现)
#include using namespace std; int find_min(int* nums, int l, int r) { int mid_loc = (l + r) / 2; int new_l = l; int new_r = r; if (nums[mid_loc] >= nums[l])//new_l一定定位于前面的数组中的 new_l = mid_loc;原创 2017-11-12 12:52:21 · 170 阅读 · 0 评论 -
有用网址
牛客网剑指offer:https://www.nowcoder.com/ta/coding-interviews?page=1原创 2017-11-12 18:13:29 · 289 阅读 · 0 评论