- 博客(19)
- 收藏
- 关注
原创 层次遍历建立二叉树
//层次遍历建立二叉树#include<iostream>#include"fun.h"//typedef char ElemType;//typedef struct BiNode {// ElemType data;// struct BiNode* lchild, * rchild;//}BiTNode, * BiTree;//typedef struct Node {// BiTree p;// struct Node* next;//}QNode, * Queue
2022-05-12 20:40:19
925
1
原创 串简易操作---下标0开始存‘\0‘
#include<iostream>using namespace std;#define MaxLength 255typedef struct{ char ch[MaxLength]; int length;}SString;typedef struct{ char* ch; int len;}HStr;class Stu {public: Stu(); ~Stu(); bool StrAssign(HStr &T, char* chars); i
2022-04-11 13:05:50
257
原创 逆波兰表达式
//逆波兰表达式class Solution{public: int evalRPN(vector<string>& tokens) { stack<int> mystack;//tokens只包含了int和四个表达式则可以用int if (tokens.empty()) return 0; for (string s : tokens) {
2022-04-05 09:54:51
302
原创 括号匹配-
//数组存储class Solution {public: bool isValid(string s) { if (s.empty()) return true; char s1[10001]; int top = -1; for (char c : s) { if (c == '(' || c == '[' || c == '{') { s1[++t
2022-04-04 10:46:41
275
原创 链队列--带头节点||不带头结点
//带头结点#include<iostream>typedef int ElemType;using namespace std;struct Node { ElemType data; Node* next;};class Queue {public: Queue(); bool QueueEmpty() const; bool EnQueue(ElemType e); bool DeQueue(ElemType& e); bool GetHead(Elem
2022-04-02 11:03:54
149
原创 队列--循环--顺序存储
//顺需存储#include<iostream>using namespace std;#define MaxSize 60typedef int ElemType;typedef struct { ElemType data[MaxSize]; int front, rear;}SqQueue;bool InitSqQueue(SqQueue& Q){ Q.front = Q.rear = 0; return true;}bool QueueEmpty(Sq
2022-03-31 11:59:07
289
原创 链栈-无头节点-带头节点
//无头节点#include<stdio.h>#include<stdlib.h>typedef int ElemType;typedef struct Node{ ElemType data; struct Node* next;}*LiStack,stack;bool InitStack(LiStack& S){ S = NULL; return true;}bool Empty(LiStack S)//判断栈是否为空{ return (S
2022-03-28 10:04:50
637
1
原创 栈--顺序栈--共享栈
//顺序栈#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#define MaxSize 10typedef int ElemType;typedef struct { ElemType data[MaxSize]; int top;}SqStack;bool InitStack(SqStack& S){ S.top = -1;//指向当前栈顶元素若=0则指向下一个存储位置 return true;}bool S
2022-03-27 11:55:12
166
原创 两数相加--递归法
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */struct ListNode* addTwoNumbers_2(struct ListNode* l1, struct ListNode* l2){ if (l2 == NULL&&l1->val==-1) return l2;
2022-03-26 23:48:49
440
原创 合并两个有序链表
/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; *///递归法struct ListNode* mergeTwoLists(struct ListNode* list1, struct ListNode* list2){ if(NULL==list1&&NULL==list2) return NU
2022-03-25 23:30:38
95
原创 简易循环双链表-带头结点
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>typedef int ElemType;typedef struct DCNode { ElemType data; struct DCNode* prior, *next;}DCNode,*LinkList;bool List_TailInsert(LinkList& L){ L = (LinkList)malloc(si
2022-03-24 16:25:33
1789
原创 循环单链表-头节点
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>typedef int Elemtype;typedef struct CNode { Elemtype data; struct CNode* next;}CNode,*LinkList;bool List_TailInsert(LinkList& L){ L = (CNode*)malloc(sizeof(CNode));
2022-03-24 15:44:05
632
原创 双链表-简单操作
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>typedef int ElemType;//3 4 5 6 7 9 10 -9999typedef struct DNode { ElemType Data; struct DNode* prior, * next;}DNode,*DLinklist;void List_length(DLinklist L);bool initiL
2022-03-24 15:17:26
1038
原创 单链表_不带头结点(自用)
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>typedef int ElemType;//3 4 5 6 7 9 10 -9999typedef struct LNode { ElemType data; struct LNode* next;}LNode,*Linklist;bool initList(Linklist& L){ L = NULL; return
2022-03-21 11:00:06
1103
原创 单链表_02_带头结点(自用)
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>typedef int ElemType;//3 4 5 6 7 9 10 -9999typedef struct LNode { ElemType date; struct LNode* next;}LNode,*Linklist;bool initList(Linklist& L){ L = (LNode *)mallo
2022-03-20 10:46:29
805
原创 单链表 --头插法尾插法(函数中输入)(自用)
#define _CRT_SECURE_NO_WARNINGS#include<stdio.h>#include<stdlib.h>//3 4 5 6 7 9 10 -9999typedef int ElemType;typedef struct LNode { ElemType data; struct LNode* next;}LNode,*Linklist;Linklist List_HeadInsert(Linklist& L){ Linklis
2022-03-18 10:32:18
827
原创 顺序表--动态
#include<stdio.h>#include<stdlib.h>#define InitSize 10typedef int ElemType;typedef struct { ElemType* data; int MaxSize, len;}SqList;void InitList(SqList& L){ L.data = (ElemType*)malloc(InitSize * sizeof(ElemType)); L.MaxSize = I
2022-03-16 16:45:19
88
原创 顺序表--静态
顺序表--静态#include<stdio.h>#define MaxSize 5typedef int ElemType;typedef struct List { ElemType data[MaxSize]; int len;}SqList;void InitList(SqList& L){ //可省略因为靠L.len控制访问界限 /*for (int i = 0; i < MaxSize; i++) { L.data[i] = 0; }*/
2022-03-16 16:43:21
90
原创 网络编程技术-----windows网络编程
网络编程技术c/s简易模型–windows编程c++(未使用select)###1:sever服务器端分为以下7个步骤打开网络库校验版本创建SOKCKET绑定地质与端口开始监听接受客户端链接(创建客户端socket)与客户端发送信息1.0头文件#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include <string.h> #include <Ws2tcpip.h>//调用inet_pto
2021-11-05 21:11:43
2295
6
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人