摘要: #include "stdio.h" #include "stdlib.h" /*树节点*/ typedef struct node{ int data; struct node * left; /*节点左边的树枝*/ struct node * right;/*节点右边的树枝*/ }Node; / 阅读全文
posted @ 2021-05-16 09:48 cheshulin 阅读(343) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> /* gets */ #include <stdlib.h> /* atoi, malloc */ #include <string.h> /* strcpy */ #include "uthash.h" struct my_struct { int ikey; 阅读全文
posted @ 2020-12-27 20:03 cheshulin 阅读(100) 评论(0) 推荐(0) 编辑
摘要: typedef struct Stack_T { int *stk; // 也可以用固定值 int cnt; } Stack_S; Stack_S g_stack = {0}; void StackInit(int size) { g_stack.cnt = 0; g_stack.stk = (in 阅读全文
posted @ 2020-11-30 20:23 cheshulin 阅读(38) 评论(0) 推荐(0) 编辑
摘要: typedef struct Que_T { int head; int rear; int size; Graph_S *que[10000]; } Que_S; Que_S g_que; void QueInit() { g_que.head = 0; g_que.rear = 0; g_que 阅读全文
posted @ 2020-11-30 19:31 cheshulin 阅读(38) 评论(0) 推荐(0) 编辑
摘要: /** * Note: The returned array must be malloced, assume caller calls free(). */ #define MAX_IP_ADR 1000 #if 0 int IsValid(char* s, int i, int j) { int 阅读全文
posted @ 2020-11-26 16:25 cheshulin 阅读(46) 评论(0) 推荐(0) 编辑
摘要: /* 广度优先搜索模板 /* void BFS(int s){ queue<int> q; q.push(s); while(!q.empty()){ 取队首; 访问队首; 弹出队首; 队首元素下一层级的元素全部入队; } } */ //参见:https://leetcode-cn.com/prob 阅读全文
posted @ 2020-11-23 00:13 cheshulin 阅读(136) 评论(0) 推荐(0) 编辑
摘要: /** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */ /** * Return an arr 阅读全文
posted @ 2020-11-22 23:06 cheshulin 阅读(120) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> using namespace std; /* 最近在写一个程序的时候用到了二级指针作为函数参数的情况,就在函数内部如何操作二级指针为数组做以下探讨: 无非有两种使用方式 a[i][j] or *((type *)a + i*col + j); 先看下面的测试 阅读全文
posted @ 2020-04-05 23:32 cheshulin 阅读(193) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> void swap(int A[],int i,int j) { int tmp=0; tmp=A[i]; A[i]=A[j]; A[j]=tmp; } void Print(int A[],int n) { for (int i=0;i<n;i++) { pr 阅读全文
posted @ 2020-02-16 11:07 cheshulin 阅读(160) 评论(0) 推荐(0) 编辑
摘要: //#include #include #include //http://www.cnblogs.com/Yogurshine/p/3677201.html //http://www.cnblogs.com/litaozijin/p/6582048.html 文本方式写入和二进制方式写入的区别 using namespace std; #define ERROR 1 #define OK ... 阅读全文
posted @ 2017-08-02 00:28 cheshulin 阅读(124) 评论(0) 推荐(0) 编辑