堆与二叉树(下)

接着上次的,这里主要介绍的是堆排序,二叉树的遍历,以及之前讲题时答应过的简单二叉树问题求解


堆排序

给一组数据,升序(降序)排列

思路

思考:如果排列升序,我们应该建什么堆?

首先,如果排升序,数列最后一个数是 最大数,我们的思路是通过 向上调整 或者 向下调整,数组存放的第一个数不是最小值(小堆)就是最大值(大堆),此时我们将最后一个数与第一个数交换,使得最大值放在最后,此时再使用向上调整 或者 向下调整,得到第二大的数,重复上述动作,很明显,我们需要的第一个数是最大值,因此我们需要建大堆

反之,排降序,建立小堆


代码

#include<stdio.h>
void downAdjust(int* pa, int parent, int n)
{int child = parent * 2 + 1;while (child < n){if (child + 1 < n && pa[child] > pa[child + 1]){child++;}if (pa[parent] > pa[child]){swap(&pa[parent], &pa[child]);}else{break;}parent = child;child = parent * 2 + 1;}
}
int main()
{int arr[] = { 1,3,2,5,7,4,7,4,2,5,6,8};int n = sizeof(arr) / sizeof(arr[0]);for (int i = (n - 1 - 1) / 2; i >= 0; i--){downAdjust(arr, i, n);}for (int i = n; i > 0; ){swap(&arr[0], &arr[i - 1]);downAdjust(arr, 0, --i);}for (int i = 0; i < n; i++){printf("%d ", arr[i]);}return 0;
}

topK算法

在一组数据中,选出k个最大(最小)的数

思路

如果我们选择k个最大的数,假设数组的前k个数就是最大的数,这 k个数建立 小堆,带一个数与 后面的从第 k + 1个数开始,进行比较,如果比第一个数的就换下来,然后向下调整,直到每个所有数都比较完了


代码

void downAdjust(int* pa, int parent, int n)
{int child = parent * 2 + 1;while (child < n){if (child + 1 < n && pa[child] > pa[child + 1]){child++;}if (pa[parent] > pa[child]){swap(&pa[parent], &pa[child]);}else{break;}parent = child;child = parent * 2 + 1;}
}
#include<stdio.h>
int main()
{int arr[] = { 1,6,10,3,5,8,46,23,6,25,3,40 };int n = sizeof(arr) / sizeof(arr[0]);int k = 0;scanf("%d", &k);for (int i = (k - 1 - 1) / 2; i >= 0; i--){downAdjust(arr, i, n);}for (int i = k; i < n; i++){if (arr[i] > arr[0]){swap(&arr[i], &arr[0]);downAdjust(arr, 0, k);}}for (int i = 0; i < k; i++){printf("%d ", arr[i]);}return 0;
}

五. 二叉树的实现

1. 链接结构搭建二叉树

代码

typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL *creatnode(TLType x)
{TL*pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL *tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(3);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;return tree1;
}
#include<stdio.h>
int main()
{TL* p = NULL;p = CreatTree();
}

我们搭建了一个这样的树结构:

2. 二叉树的遍历

二叉树的遍历可以分三种:前序,中序,后序,层序

a. 前序遍历:(根,左子树,右子树)

举例

这棵树的前序遍历是怎样的?(包括空树,用N表示)

val1 val2 val4 N N val5 N N val3 val6 N N val7 N N


代码实现 

#include<stdio.h>
#include<stdlib.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL *creatnode(TLType x)
{TL*pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL *tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;return tree1;
}
#include<stdio.h>
void PrevOrder(TL *root)
{if (root == NULL){printf("N ");return;}printf("%d ", root->val);PrevOrder(root->left);PrevOrder(root->right);
}
int main()
{TL* p = NULL;p = CreatTree();PrevOrder(p);
}

运行结果:

b. 中序遍历:(左子树,根,右子树)

举例

这棵树的中序遍历是怎样的?(包括空树,用N表示)

N val4 N val2 N val5 N val1 N val6 N val3 N val7 N


 代码实现

#include<stdio.h>
#include<stdlib.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL *creatnode(TLType x)
{TL*pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL *tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;return tree1;
}
#include<stdio.h>
void InOder(TL* root)
{if (root == NULL){printf("N ");return;}InOder(root->left);printf("%d ", root->val);InOder(root->right);
}
int main()
{TL* p = NULL;p = CreatTree();InOder(p);
}

运行结果:

c. 后序遍历:(左子树,右子树,根)

举例

这棵树的后序遍历是怎样的?(包括空树,用N表示)

N N val4 N N val5 val2 N N val6 N N val7 val3 val1


代码实现 

#include<stdio.h>
#include<stdlib.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL* creatnode(TLType x)
{TL* pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL* tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;return tree1;
}
void PostOder(TL* root)
{if (root == NULL){printf("N ");return;}PostOder(root->left);PostOder(root->right);printf("%d ", root->val);
}
int main()
{TL* p = NULL;p = CreatTree();PostOder(p);
}

运行结果:

d. 层序遍历

一排排的遍历

画图举例

实现思路 

这里我们借助队列(可以先进先出),开辟的数组里面存放根节点的地址(通过地址可以找到左右子树,否则如果存值是没有办法找到左右子树),打印完根节点的值,就释放,存入左右子树的节点

代码实现

实现的二叉树是这样的:

#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL* creatnode(TLType x)
{TL* pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL* tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;return tree1;
}
typedef struct QueueNode
{struct QueueNode* next;TL* data;
}QNode;typedef struct Queue
{QNode* head;QNode* tail;int size;
}Que;void QueueInit(Que* pq)
{assert(pq);pq->head = pq->tail = NULL;pq->size = 0;
}void QueueDestroy(Que* pq)
{assert(pq);QNode* cur = pq->head;while (cur){QNode* next = cur->next;free(cur);cur = next;}pq->head = pq->tail = NULL;pq->size = 0;
}void QueuePush(Que* pq, TL* x)
{assert(pq);QNode* newnode = (QNode*)malloc(sizeof(QNode));if (newnode == NULL){perror("malloc fail");exit(-1);}newnode->data = x;newnode->next = NULL;if (pq->tail == NULL){pq->head = pq->tail = newnode;}else{pq->tail->next = newnode;pq->tail = newnode;}pq->size++;
}bool QueueEmpty(Que* pq)
{assert(pq);return pq->head == NULL;
}
void QueuePop(Que* pq)
{assert(pq);assert(!QueueEmpty(pq));if (pq->head->next == NULL){free(pq->head);pq->head = pq->tail = NULL;}else{QNode* next = pq->head->next;free(pq->head);pq->head = next;}pq->size--;
}TL* QueueFront(Que* pq)
{assert(pq);assert(!QueueEmpty(pq));return pq->head->data;
}int QueueSize(Que* pq)
{assert(pq);return pq->size;
}
void leverOrder(TL* root, Que* pq)
{QueuePush(pq, root);while (!QueueEmpty(pq)){TL* pa = QueueFront(pq);printf("%d ", pa->val);QueuePop(pq);if (pa->left != NULL){QueuePush(pq, pa->left);}if (pa->right != NULL){QueuePush(pq, pa->right);}}}
int main()
{TL* p = NULL;p = CreatTree();Que q;QueueInit(&q);leverOrder(p, &q);return 0;
}

运行结果:

3. 简单二叉树经典问题求解

a. 求二叉树的节点个数

思路

想要求二叉树的节点可以分成 根节点 + 左子树 + 右子树

这里的遍历类似 前序遍历

代码

实现的树是这样的:

#include<stdio.h>
#include<stdlib.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL* creatnode(TLType x)
{TL* pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL* tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;return tree1;
}
int TreeSize(TL* root)
{if (root == NULL){return 0;}return 1 + TreeSize(root->left) + TreeSize(root->right);
}
int main()
{TL* p = NULL;p = CreatTree();int size = TreeSize(p);printf("%d ", size);return 0;
}

b. 求树的高度

思路

求二叉树的高度,我们需要找到到那个最长的路径,这里采用分治的思想,如果为空树,返回 0 (空树高度为 0),调用左子树和右子树都会 + 1(+ 1可以理解成加上节点的高度),对比左子树和右子树,返回高度最大的那个

注:每求一次左右节点个数时,一定要保存,否则会有很大的时间浪费


代码

#include<stdio.h>
#include<stdlib.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL* creatnode(TLType x)
{TL* pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL* tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);TL* tree8 = creatnode(8);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;tree4->left = tree8;return tree1;
}
int TreeHigh(TL* root)
{if (root == NULL){return 0;}int Left = 1 + TreeHigh(root->left);int Right = 1 +  TreeHigh(root->right) ;return Left > Right ? Left : Right;
}
int main()
{TL* p = NULL;p = CreatTree();int high = TreeHigh(p);printf("%d ", high);return 0;
}

c. 求根节点的个数

思路

判断是否是根节点的方法就是判断它的左右子树是否是 空树,我们只需要遍历这棵树就行,但如果遍历时,根节点遇到空树这也是一种结束条件


代码

#include<stdio.h>
#include<stdlib.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL* creatnode(TLType x)
{TL* pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL* tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);TL* tree8 = creatnode(8);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;tree4->left = tree8;return tree1;
}
int RootSize(TL* root)
{if (root == NULL){return 0;}if (root->left == NULL && root->right == NULL){return 1;}return RootSize(root->left) + RootSize(root->right);
}
int main()
{TL* p = NULL;p = CreatTree();int root = RootSize(p);printf("%d ", root);return 0;
}

d. 求倒数第k排节点的个数

思路

这个可以是求树的高度的变形,将计数倒过来


代码 

#include<stdio.h>
#include<stdlib.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL* creatnode(TLType x)
{TL* pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL* tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);TL* tree8 = creatnode(8);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;tree4->left = tree8;return tree1;
}int TreeHigh(TL* root)
{if (root == NULL){return 0;}int Left = 1 + TreeHigh(root->left);int Right = 1 +  TreeHigh(root->right) ;return Left > Right ? Left : Right;
}
int RootKsize(TL* root,int n,int k)
{if (root == NULL){return 0;}if (n == k){return 1;}return RootKsize(root->left, n - 1, k) + RootKsize(root->right, n - 1, k);
}
int main()
{int k = 0;scanf("%d", &k);TL* p = NULL;p = CreatTree();int high = TreeHigh(p);int rootk = RootKsize(p, high, k);printf("%d ", rootk);return 0;
}

e. 判断是否是相同的树

思路

采用前序,先比较根节点是否相同,再比较左右子树是否相同

代码

#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL* creatnode(TLType x)
{TL* pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree1()
{TL* tree1 = creatnode(1);TL* tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);TL* tree8 = creatnode(8);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;tree4->left = tree8;return tree1;
}
TL* CreatTree2()
{TL* tree1 = creatnode(1);TL* tree2 = creatnode(2);TL* tree3 = creatnode(3);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;return tree1;
}
bool IsSameTree(TL* root1,TL* root2)
{if (root1 == NULL && root2 == NULL){return true;}if (root1 == NULL || root2 == NULL){return false;}if (root1->val != root2->val){return false;}return IsSameTree(root1->left, root2->left) && IsSameTree(root1->right, root2->right);
}
int main()
{TL* p = NULL;p = CreatTree1();TL* q = CreatTree2();printf("%d ", IsSameTree(p, q));return 0;
}

f. 找到某个值,返回节点的地址

思路

前序遍历完数组,如果对比左右子树,判断是否找到节点的地址

代码

#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
typedef int TLType;
typedef struct TreeList
{TLType val;struct TreeList* left;struct TreeList* right;
}TL;
TL* creatnode(TLType x)
{TL* pa = (TL*)malloc(sizeof(TL));if (pa == NULL){perror("malloc");return;}TL* newnode = pa;newnode->left = newnode->right = NULL;newnode->val = x;return newnode;
}
TL* CreatTree()
{TL* tree1 = creatnode(1);TL* tree2 = creatnode(2);TL* tree3 = creatnode(2);TL* tree4 = creatnode(4);TL* tree5 = creatnode(5);TL* tree6 = creatnode(6);TL* tree7 = creatnode(7);TL* tree8 = creatnode(8);tree1->left = tree2;tree1->right = tree3;tree2->left = tree4;tree2->right = tree5;tree3->left = tree6;tree3->right = tree7;tree4->left = tree8;return tree1;
}
TL* FindRoot(TL* root,int m)
{if (root == NULL){return NULL;}if (root->val == m){return root;}TL* Left = FindRoot(root->left, m);TL* Right = FindRoot(root->right, m);if (Left == NULL && Right == NULL){return NULL;}if (Left == NULL && Right != NULL){return Right;}else {return Left;}}
int main()
{TL* p = NULL;p = CreatTree();int m = 0;scanf("%d", &m);TL *root = FindRoot(p,m);if (root == NULL){printf("找不到\n");}else{printf("%d ", root->val);}return 0;
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.rhkb.cn/news/223905.html

如若内容造成侵权/违法违规/事实不符,请联系长河编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

DLLNotFoundException:xxx tolua... 错误打印

DLLNotFoundException:xxx tolua... 错误打印 一、DLLNotFoundException介绍二、Plugins文件夹文件目录结构如下&#xff1a; 三、Plugins中的Android文件夹四、Plugins中的IOS文件夹这里不说了没测试过不过原理应该也是选择对应的平台即可五、Plugins中的x86和X86_64文件夹 一…

【贪心】买卖股票的最佳时机含手续费

/** 贪心&#xff1a;每次选取更低的价格买入&#xff0c;遇到高于买入的价格就出售(此时不一定是最大收益)。* 使用buy表示买入股票的价格和手续费的和。遍历数组&#xff0c;如果后面的股票价格加上手续费* 小于buy&#xff0c;说明有更低的买入价格更新buy。如…

先进制造身份治理现状洞察:从手动运维迈向自动化身份治理时代

在新一轮科技革命和产业变革的推动下&#xff0c;制造业正面临绿色化、智能化、服务化和定制化发展趋势。为顺应新技术革命及工业发展模式变化趋势&#xff0c;传统工业化理论需要进行修正和创新。其中&#xff0c;对工业化水平的判断标准从以三次产业比重标准为主回归到工业技…

Qt制作定时关机小程序

文章目录 完成效果图ui界面ui样图 main函数窗口文件头文件cpp文件 引言 一般定时关机采用命令行模式&#xff0c;还需要我们计算在多久后关机&#xff0c;我们可以做一个小程序来定时关机 完成效果图 ui界面 <?xml version"1.0" encoding"UTF-8"?>…

EA常见画图(类图、包图、构件图、状态图、顺序图、活动图)

EA常见活动图&#xff0c;状态图画法 类图:111&#xff08;1&#xff09;给关系添加注释&#xff08;2&#xff09;设置关系线样式 包图&#xff1a;&#xff08;1&#xff09;创建包图&#xff08;2&#xff09;在包中添加子包&#xff1a;&#xff08;3&#xff09;在包中添加…

微前端——无界wujie

B站课程视频 课程视频 课程课件笔记&#xff1a; 1.微前端 2.无界 现有的微前端框架&#xff1a;iframe、qiankun、Micro-app&#xff08;京东&#xff09;、EMP&#xff08;百度&#xff09;、无届 前置 初始化 新建一个文件夹 1.通过npm i typescript -g安装ts 2.然后可…

IDEA控制台乱码

报错情况&#xff1a; 报错原因&#xff1a;Idea的vm用的编码格式不一致&#xff1a;需要修改为UTF-8 你看Tomcat我之前下在后修改果&#xff0c;就没有报错&#xff0c;新人刚下载也有乱码问题 问题解决&#xff1a; 按我步骤来一定对 下面这俩文件打开输入&#xff1a; -D…

CSS-SVG-环形进度条

线上代码地址 <div class"circular-progress-bar"><svg><circle class"circle-bg" /><circle class"circle-progress" style"stroke-dasharray: calc(2 * 3.1415 * var(--r) * (var(--percent) / 100)), 1000" …

esp32使用lvgl,给图片取模显示图片

使用LVGL官方工具。 https://lvgl.io/tools/imageconverter 上传图片&#xff0c;如果想要透明效果&#xff0c;那么选择 输出格式C array&#xff0c;点击Convert进行转换。 下载.c文件放置到工程下使用即可。

Java开发框架和中间件面试题(1)

1.什么是Spring框架&#xff1f; Spring是一种轻量级框架&#xff0c;旨在提高开发人员的开发效率以及系统的可维护性。 我们一般说的Spring框架就是Spring Framework,它是很多模块的集合&#xff0c;使用这些模块可以很方便的协助我们进行开发。这些模块是核心容器、数据访…

3.[BUUCTF HCTF 2018]WarmUp1

1.看题目提示分析题目内容 盲猜一波~ &#xff1a; 是关于PHP代码审计的 2.打开链接&#xff0c;分析题目 给你提示了我们访问source.php来看一下 大boss出现&#xff0c;开始详细手撕~ 3.手撕PHP代码&#xff08;代码审计&#xff09; 本人是小白&#xff0c;所以第一步&…

解读SPP / SPPF / SimSPPF / ASPP / RFB / SPPCSPC

SPP与SPPF 一、SPP的应用的背景 在卷积神经网络中我们经常看到固定输入的设计&#xff0c;但是如果我们输入的不能是固定尺寸的该怎么办呢&#xff1f; 通常来说&#xff0c;我们有以下几种方法&#xff1a; &#xff08;1&#xff09;对输入进行resize操作&#xff0c;让他们…

案例144:基于微信小程序的自修室预约系统

文末获取源码 开发语言&#xff1a;Java 框架&#xff1a;SSM JDK版本&#xff1a;JDK1.8 数据库&#xff1a;mysql 5.7 开发软件&#xff1a;eclipse/myeclipse/idea Maven包&#xff1a;Maven3.5.4 小程序框架&#xff1a;uniapp 小程序开发软件&#xff1a;HBuilder X 小程序…

Unity手机移动设备重力感应

Unity手机移动设备重力感应 一、引入二、介绍三、测试成果X Y轴Z轴横屏的手机&#xff0c;如下图竖屏的手机&#xff0c;如下图 一、引入 大家对重力感应应该都不陌生&#xff0c;之前玩过的王者荣耀的资源更新界面就是使用了重力感应的概念&#xff0c;根据手机的晃动来给实体…

Latex生成的PDF中加入书签/Navigation/导航

本文参考&#xff1a;【Latex学习】在生成pdf中加入书签/目录/提纲_latex 书签-CSDN博客 &#xff08;这篇文章写的真的太棒了&#xff01;非常推荐&#xff09; 题外话&#xff0c;我的碎碎念&#xff0c;这也是我如何提高搜索能力的办法&#xff1a;想在Latex生成的PDF中加入…

2023美团机器人研究院学术年会成功举办

2023年12月19日&#xff0c;深圳市美团机器人研究院学术年会在清华大学深圳国际研究生院成功落下帷幕。会议回顾了研究院成立一年来的进展和成果&#xff0c;并邀请了各界专家共同讨论机器人技术的未来发展趋势。此外&#xff0c;年会期间还举办了首届低空经济智能飞行管理挑战…

【网络安全/CTF】unseping 江苏工匠杯

该题考察序列化反序列化及Linux命令执行相关知识。 题目 <?php highlight_file(__FILE__);class ease{private $method;private $args;function __construct($method, $args) {$this->method $method;$this->args $args;}function __destruct(){if (in_array($thi…

安洵杯 re + 其他部分题解

第11&#xff0c;比较小丑&#xff0c;差了一步队伍wp应该会发吧&#xff0c;不知道&#xff0c;我先放点跟我有关系的 Re mobilego so的check看了一会比较南崩&#xff0c;但是看flag的密文形式很像简单位置替换所以直接输编码表&#xff0c;jeb动调然后得到替换表解密就行…

CnosDB:深入了解时序数据处理函数

CnosDB 是一个专注于时序数据处理的数据库&#xff0c;旨在解决时序数据存储与分析问题&#xff0c;为用户提供高效的时序数据管理与查询便利。为了实现这一目标&#xff0c;CnosDB 实现了一系列专用函数&#xff0c;快来和CC一起来看看吧&#xff01; CnosDB&#xff1a;深入了…

PHP下载安装以及基本配置

目录 引言 官网 下载 配置 1. 鼠标右键“此电脑”>“属性” 2. 打开高级系统设置 3. 打开环境变量 4. 双击系统变量中的path 5. 新建新的path 6. 将刚刚安装的位置加入环境变量 7. 检查是否安装成功 引言 PHP&#xff08;"PHP: Hypertext Preprocessor"…