LeetCode 栈和队列OJ题目分享

news2024/9/28 23:32:32

目录

  • 有效的括号(括号匹配)
  • 用栈实现队列
  • 用队列实现栈
  • 设计循环队列

有效的括号(括号匹配)

链接: link
题目描述:
在这里插入图片描述
题目思路:

1、如果是左括号“( { [ ”就入栈

2、如果是右括号“) } ] ”,就取出栈顶元素与该右括号进行匹配
如果不匹配,就直接return false
如果匹配,s++,指针继续向下走,寻找下一个括号,进行上述操作

注意:
1、如果只有左括号,则栈不为空,则要return false
2、如果只有右括号,栈为空,不能取栈顶元素进行匹配
3、内存泄漏问题,每次返回一个bool值之前都要销毁栈,以免发生内存泄漏
代码实现:

typedef char STDataType;
typedef struct Stack
{
	STDataType* a;
	int top;
	int capacity;
}ST;

void STInit(ST* pst);
void STDestroy(ST* pst);
void STPush(ST* pst, STDataType x);
void STPop(ST* pst);
STDataType STTop(ST* pst);
bool STEmpty(ST* pst);
int STSize(ST* pst);
void STInit(ST* pst)
{
	assert(pst);
	pst->a = NULL;//最开始不malloc空间
	//pst->top = -1;//指向栈顶元素
	pst->top = 0;//指向栈顶元素的下一个位置,表示已经有元素
	pst->capacity = 0;
}
void STDestroy(ST* pst)
{
	assert(pst);
	free(pst->a);
	pst->a = NULL;
	pst->top = 0;
	pst->capacity = 0;
}
void STPush(ST* pst, STDataType x)
{
	assert(pst);
	if (pst->top == pst->capacity)
	{
		int newcapacity = pst->capacity == 0 ? 4 : pst->capacity * 2;
		STDataType* tmp = (STDataType*)realloc(pst->a, sizeof(STDataType) * newcapacity);
		if (tmp == NULL)
		{
			perror("realloc fail");
			return;
		}
		pst->a = tmp;
		pst->capacity = newcapacity;
	}
	pst->a[pst->top] = x;
	pst->top++;
}
void STPop(ST* pst)
{
	assert(pst);
	assert(!STEmpty(pst));
	pst->top--;
}
STDataType STTop(ST* pst)
{
	assert(pst);
	assert(!STEmpty(pst));
	return pst->a[pst->top - 1];//栈顶元素
}
bool STEmpty(ST* pst)
{
	return pst->top == 0;
}
int STSize(ST* pst)
{
	assert(pst);
	return pst->top;
}

bool isValid(char * s)
{
    ST st;
    STInit(&st);
    while(*s)
    {
         //1、左括号入栈
        if(*s=='('
        || *s=='{'
        || *s=='[')
        {
            STPush(&st,*s);
        }
        //2、右括号出栈匹配
        else
        {
            //不匹配情况

            //如果栈空,只有右括号,则不匹配,直接返回false
            if(STEmpty(&st))
            {
                return false;
            }
            char top = STTop(&st);
            STPop(&st);
            if((*s==']'&&top!='[')
            || (*s=='}'&&top!='{')
            ||(*s==')'&&top!='('))
            {
                return false;
            }
            //匹配
        }
        s++;//向后遍历字符串寻找括号
    }
    bool ret = STEmpty(&st);//如果栈空返回true,否则返回false
    STDestroy(&st);
    return ret;
}

用栈实现队列

链接: link
题目描述:
在这里插入图片描述
在这里插入图片描述
题目思路:

两个栈实现队列,首先明确:
栈后进先出
队列先进先出

![在这里插入图片描述](https://img-blog.csdnimg.cn/a031ca50ab964ca6bd8b008f47c65dbf.png方法:
方法:
在这里插入图片描述

此处方法就是先倒数据,将栈1的元素4 3 2全部导入栈2中,最后删除1,如下图

在这里插入图片描述

在这个过程中,将栈1的全部元素导入栈2后,我们可以发现栈2出栈的顺序就是队列出队的顺序,于是可以将两个栈做如下更改:

在这里插入图片描述
分析:

1、队列的结构

typedef struct 
{
    ST pushst;
    ST popst;
} MyQueue;
MyQueue* myQueueCreate() 
{
    MyQueue* obj = (MyQueue*)malloc(sizeof(MyQueue));
    if(obj==NULL)
    {
        perror("malloc fail");
        return NULL;
    }
    STInit(&obj->pushst);
    STInit(&obj->popst);
    return obj;
}

2、入队操作
在这里插入图片描述

此处入队操作就是入栈操作,将元素入到pushst栈当中

void myQueuePush(MyQueue* obj, int x) 
{
    STPush(&obj->pushst,x);
}

3、返回队列开头元素在这里插入图片描述

首先判断popst中是否为空,如果popst为空,判断pushst是否为空,如果pushst不为空,将pushst中的元素入栈到popst中,最后返回popst的栈顶元素

int myQueuePeek(MyQueue* obj) //只取栈顶元素
{
    if(STEmpty(&obj->popst))
    {
        while(!STEmpty(&obj->pushst))
        {
            STPush(&obj->popst,STTop(&obj->pushst));
            STPop(&obj->pushst);
        }
    }
    return STTop(&obj->popst);//popst中的栈顶元素,即pushst中的栈底元素
}

4、移除队列开头的元素,并返回队头元素
在这里插入图片描述

复用myQueuePeek函数,保存该函数的返回值,再出popst的栈顶元素

int myQueuePop(MyQueue* obj) //删数据 
{
    int front = myQueuePeek(obj);
    STPop(&obj->popst);
    return front;
}

5、判空
在这里插入图片描述

popst和pushst同时为空

bool myQueueEmpty(MyQueue* obj) 
{
    return STEmpty(&obj->pushst)&&STEmpty(&obj->popst);
}

6、销毁

void myQueueFree(MyQueue* obj) 
{
    STDestroy(&obj->pushst);
    STDestroy(&obj->popst);
     free(obj);
}

整体代码:

typedef int STDataType;
typedef struct Stack
{
	STDataType* a;
	int top;
	int capacity;
}ST;

void STInit(ST* pst);
void STDestroy(ST* pst);
void STPush(ST* pst, STDataType x);
void STPop(ST* pst);
STDataType STTop(ST* pst);
bool STEmpty(ST* pst);
int STSize(ST* pst);

void STInit(ST* pst)
{
	assert(pst);
	pst->a = NULL;//最开始不malloc空间
	//pst->top = -1;//指向栈顶元素
	pst->top = 0;//指向栈顶元素的下一个位置,表示已经有元素
	pst->capacity = 0;
}
void STDestroy(ST* pst)
{
	assert(pst);
	free(pst->a);
	pst->a = NULL;
	pst->top = 0;
	pst->capacity = 0;
}
void STPush(ST* pst, STDataType x)
{
	assert(pst);
	if (pst->top == pst->capacity)
	{
		int newcapacity = pst->capacity == 0 ? 4 : pst->capacity * 2;
		STDataType* tmp = (STDataType*)realloc(pst->a, sizeof(STDataType) * newcapacity);
		if (tmp == NULL)
		{
			perror("realloc fail");
			return;
		}
		pst->a = tmp;
		pst->capacity = newcapacity;
	}
	pst->a[pst->top] = x;
	pst->top++;
}
void STPop(ST* pst)
{
	assert(pst);
	assert(!STEmpty(pst));
	pst->top--;
}
STDataType STTop(ST* pst)
{
	assert(pst);
	assert(!STEmpty(pst));
	return pst->a[pst->top - 1];//栈顶元素
}
bool STEmpty(ST* pst)
{
	return pst->top == 0;
}
int STSize(ST* pst)
{
	assert(pst);
	return pst->top;
}
typedef struct 
{
    ST pushst;
    ST popst;
} MyQueue;
MyQueue* myQueueCreate() 
{
    MyQueue* obj = (MyQueue*)malloc(sizeof(MyQueue));
    if(obj==NULL)
    {
        perror("malloc fail");
        return NULL;
    }
    STInit(&obj->pushst);
    STInit(&obj->popst);
    return obj;
}


void myQueuePush(MyQueue* obj, int x) 
{
    STPush(&obj->pushst,x);
}

int myQueuePop(MyQueue* obj) //删数据 
{
    int front = myQueuePeek(obj);
    STPop(&obj->popst);
    return front;
}

int myQueuePeek(MyQueue* obj) //只取栈顶元素
{
    if(STEmpty(&obj->popst))
    {
        while(!STEmpty(&obj->pushst))
        {
            STPush(&obj->popst,STTop(&obj->pushst));
            STPop(&obj->pushst);
        }
    }
    return STTop(&obj->popst);//popst中的栈顶元素,即pushst中的栈底元素
}

bool myQueueEmpty(MyQueue* obj) 
{
    return STEmpty(&obj->pushst)&&STEmpty(&obj->popst);
}

void myQueueFree(MyQueue* obj) 
{
    STDestroy(&obj->pushst);
    STDestroy(&obj->popst);
     free(obj);
}

用队列实现栈

链接: link
题目描述:
在这里插入图片描述
在这里插入图片描述
题目思路:

题目中给我们两个队列实现一个栈,首先明确:
1、队列的性质:先进先出
2、栈的性质:后进先出

在这里插入图片描述

如何才能使用两个队列实现栈的后进先出?
本题给的两个队列就是用来导数据,进而实现栈的后进先出的性质

举例:如上图,如果说我们要出数据5,那么就需要将队列1当中的1 2 3 4 先入到队列2中,再出数据5,这样就实现了后进先出的性质。
在这里插入图片描述
注意:
如何入数据?
1、如果两个队列中的一个队列为空一个队列不为空,那么数据入到非空队列中
2、如果两个队列都为空,数据入到其中一个队列
分析:
1、栈的结构和栈的创建
在这里插入图片描述

方法1:给定MyStack栈中的两个队列都是结构体类型,直接malloc动态开辟一个栈的空间,里面存放队列1 q1和队列2 q2
初始化队列使用结构体指针。

在这里插入图片描述

方法2:给定MyStack栈中的两个队列都是结构体指针类型,动态开辟栈的空间,再动态开辟队列的空间,这样在初始化时就不需要进行取地址操作,因为q1和q2就是结构体指针类型。

在这里插入图片描述
2、入数据操作
在这里插入图片描述

1、如果q1不为空,那么就入队列1中
2、如果q2不为空,那么就入队列2中
3、如果两个都不为空,则随意入队列

void myStackPush(MyStack* obj, int x) 
{
    if(!QueueEmpty(&obj->q1))
    {
        QueuePush(&obj->q1,x);
    }
    else
    {
        QueuePush(&obj->q2,x);
    }
}

3、出栈操作——倒数据

1、将非空队列的队头的数据导入空队列当中——入队
2、弹出非空队列的队头数据
3、取栈顶元素

int myStackPop(MyStack* obj) 
{
    Queue* qEmpty=&obj->q1;
    Queue* qNoneEmpty = &obj->q2;
    if(!QueueEmpty(&obj->q1))
    {
        Queue* qEmpty=&obj->q2;
        Queue* qNoneEmpty = &obj->q1;
    }
    while(QueueSize(qNoneEmpty)>1)
    {
        QueuePush(qEmpty,QueueFront(qNoneEmpty));
        QueuePop(qNoneEmpty);
    }
    int top = QueueFront(qNoneEmpty);
    QueuePop(qNoneEmpty);
    return top;
}

4、取栈顶元素——队尾元素

1、第一个队列不为空,就取队尾元素
2、反之取第二个队列的队尾元素

int myStackTop(MyStack* obj) 
{
    if(!QueueEmpty(&obj->q1))
    {
        return QueueBack(&obj->q1);
    }
    else
    {
        return QueueBack(&obj->q2);
    }
}

5、判空

bool myStackEmpty(MyStack* obj) 
{
    return QueueEmpty(&obj->q1)&&QueueEmpty(&obj->q2);
}

6、销毁

不仅释放栈,也要释放队列

void myStackFree(MyStack* obj) 
{
    QueueDestroy(&obj->q1);
    QueueDestroy(&obj->q2);
    free(obj);
}

整体代码:

typedef int QDataType;
//每个节点的结构

typedef struct QueueNode
{
	QDataType data;
	struct QueueNode* next;
}QNode;

//标识整个队列的结构
typedef struct Queue
{
	QNode* phead;
	QNode* ptail;
	int size;//队列的长度
}Queue;
void QueueInit(Queue* pq);
void QueueDestroy(Queue* pq);
void QueuePush(Queue* pq, QDataType x);
void QueuePop(Queue* pq);
QDataType QueueFront(Queue* pq);
QDataType QueueBack(Queue* pq);
int QueueSize(Queue* pq);
bool QueueEmpty(Queue* pq);

void QueueInit(Queue* pq)
{
	assert(pq);
	pq->phead = NULL;
	pq->ptail = NULL;
	pq->size = 0;
}
void QueueDestroy(Queue* pq)
{
	assert(pq);
	QNode* cur = pq->phead;
	while (cur)
	{
		QNode* next = cur->next;
		free(cur);
		cur = next;
	}
	pq->phead = pq->ptail = NULL;
	pq->size = 0;
}
void QueuePush(Queue* pq, QDataType x)
{
	assert(pq);
	QNode* newnode = (QNode*)malloc(sizeof(QNode));
	if (newnode == NULL)
	{
		perror("malloc fail");
		return;
	}
	newnode->data = x;
	newnode->next = NULL;
	
	//队列为空
	if (pq->ptail == NULL)
	{
		assert(pq->phead == NULL);
		pq->phead = pq->ptail = newnode;
	}
	else
	{
		//队列不空
		pq->ptail->next = newnode;
		pq->ptail = newnode;
	}
	pq->size++;
}
void QueuePop(Queue* pq)
{
	//类似头删
	assert(pq);
	assert(!QueueEmpty(pq));
	//1、一个节点
	//2、多个节点
	if (pq->phead->next == NULL)
	{
		free(pq->phead);
		pq->phead = pq->ptail = NULL;
	}
	else
	{
		//头删
		QNode* next = pq->phead->next;
		free(pq->phead);
		pq->phead = next;
	}
	pq->size--;
}
QDataType QueueFront(Queue* pq)
{
	assert(pq);
	assert(!QueueEmpty(pq));
	return pq->phead->data;
}
QDataType QueueBack(Queue* pq)
{
	assert(pq);
	assert(!QueueEmpty(pq));
	return pq->ptail->data;
}
int QueueSize(Queue* pq)
{
	assert(pq);
	return pq->size;
}
bool QueueEmpty(Queue* pq)
{
	assert(pq);
	//return pq->size == 0;
	return pq->phead == NULL && pq->ptail == NULL;
}

typedef struct
{
    Queue q1;//队列1
    Queue q2;//队列2
} MyStack;


MyStack* myStackCreate()
{
    MyStack* obj = (MyStack*)malloc(sizeof(MyStack));
    if (obj == NULL)
    {
        perror("malloc fail");
        return NULL;
    }
    QueueInit(&obj->q1);
    QueueInit(&obj->q2);
    return obj;
}

void myStackPush(MyStack* obj, int x) 
{
    if(!QueueEmpty(&obj->q1))
    {
        QueuePush(&obj->q1,x);
    }
    else
    {
        QueuePush(&obj->q2,x);
    }
}

int myStackPop(MyStack* obj) 
{
    Queue* qEmpty=&obj->q1;
    Queue* qNoneEmpty = &obj->q2;
    if(!QueueEmpty(&obj->q1))
    {
       qEmpty=&obj->q2;
       qNoneEmpty = &obj->q1;
    }
    while(QueueSize(qNoneEmpty)>1)
    {
        QueuePush(qEmpty,QueueFront(qNoneEmpty));
        QueuePop(qNoneEmpty);
    }
    int top = QueueFront(qNoneEmpty);
    QueuePop(qNoneEmpty);
    return top;
}

int myStackTop(MyStack* obj) 
{
    if(!QueueEmpty(&obj->q1))
    {
        return QueueBack(&obj->q1);
    }
    else
    {
        return QueueBack(&obj->q2);
    }
}

bool myStackEmpty(MyStack* obj) 
{
    return QueueEmpty(&obj->q1)&&QueueEmpty(&obj->q2);
}

void myStackFree(MyStack* obj) 
{
    QueueDestroy(&obj->q1);
    QueueDestroy(&obj->q2);
    free(obj);
}

设计循环队列

链接: link
题目描述:
在这里插入图片描述
在这里插入图片描述
思路分析:
在这里插入图片描述

本题使用数组设计循环队列
1、假设循环队列存储k个数据,开k+1个空间,每次入队一个元素,rear指针都会指向该元素的后一个位置。

在这里插入图片描述
在这里插入图片描述

1、循环队列的结构

在这里插入图片描述

typedef struct 
{
    int front;
    int rear;
    int k;//队列中元素个数
    int* a;
} MyCircularQueue;


MyCircularQueue* myCircularQueueCreate(int k) 
{
    MyCircularQueue* obj = (MyCircularQueue*)malloc(sizeof(MyCircularQueue));
    obj->a = (int*)malloc(sizeof(int*)*(k+1));
    obj->front=obj->rear = 0;
    obj->k=0;
    return obj;
}

2、判断循环队列为空:front=rear
在这里插入图片描述

bool myCircularQueueIsEmpty(MyCircularQueue* obj) 
{
    return obj->rear==obj->front;
}

3、判断队列满:(rear+1)%(k+1)==front
在这里插入图片描述

bool myCircularQueueIsFull(MyCircularQueue* obj) 
{
    return (obj->rear+1)%(obj->k+1)==obj->front;

}

4、入数据

在rear位置入数据再让rear++,特殊情况:循环队列可能会绕回去,所以要判断rear的位置

在这里插入图片描述

bool myCircularQueueEnQueue(MyCircularQueue* obj, int value) 
{
    if( myCircularQueueIsEmpty(obj))
    {
        return false;
    }
    obj->a[obj->rear]=value;
    obj->rear++;
    obj->rear%=(obj->k+1);//保证范围
}

5、出数据(删除数据)

判空,如果为空,则不进行删除操作
删除操作即让front++,并且保证front的范围

在这里插入图片描述

bool myCircularQueueDeQueue(MyCircularQueue* obj) 
{
     if( myCircularQueueIsEmpty(obj))
    {
        return false;
    }
    obj->front++;
    obj->front%=(obj->k+1);//保证范围
    return true;
}

6、返回队头和队尾数据
在这里插入图片描述
在这里插入图片描述

int myCircularQueueFront(MyCircularQueue* obj) 
{
    if(myCircularQueueIsEmpty(obj))
    {
        return -1;
    }
    return obj->a[obj->front];
}

int myCircularQueueRear(MyCircularQueue* obj) 
{
    if(myCircularQueueIsEmpty(obj))
    {
        return -1;
    }
    else if(obj->rear==0)
    {
        return obj->a[obj->rear+k-1];
    }
    else
    {
        return obj->a[obj->rear-1];
    }
}

整体代码:

typedef struct 
{
    int front;
    int rear;
    int k;//队列中元素个数
    int* a;
} MyCircularQueue;

bool myCircularQueueIsEmpty(MyCircularQueue* obj) 
{
    return obj->rear==obj->front;
}

bool myCircularQueueIsFull(MyCircularQueue* obj) 
{
    return (obj->rear+1)%(obj->k+1)==obj->front;

}
MyCircularQueue* myCircularQueueCreate(int k) 
{
    MyCircularQueue* obj = (MyCircularQueue*)malloc(sizeof(MyCircularQueue));
    obj->a = (int*)malloc(sizeof(int)*(k+1));
    obj->front=obj->rear = 0;
    obj->k=k;
    return obj;
}

bool myCircularQueueEnQueue(MyCircularQueue* obj, int value) 
{
    if( myCircularQueueIsFull(obj))
    {
        return false;
    }
    obj->a[obj->rear]=value;
    obj->rear++;
    obj->rear%=(obj->k+1);//保证范围
    return true;
}

bool myCircularQueueDeQueue(MyCircularQueue* obj) 
{
     if( myCircularQueueIsEmpty(obj))
    {
        return false;
    }
    obj->front++;
    obj->front%=(obj->k+1);//保证范围
    return true;
}

int myCircularQueueFront(MyCircularQueue* obj) 
{
    if(myCircularQueueIsEmpty(obj))
    {
        return -1;
    }
    return obj->a[obj->front];
}

int myCircularQueueRear(MyCircularQueue* obj) 
{
    if(myCircularQueueIsEmpty(obj))
    {
        return -1;
    }
   return obj->a[(obj->rear+obj->k)%(obj->k+1)];
}



void myCircularQueueFree(MyCircularQueue* obj) 
{
    free(obj->a);
    free(obj);
}

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

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Redis--弱口令未授权访问漏洞

Redis--弱口令未授权访问漏洞 一、漏洞简介二、危险等级三、漏洞影响四、入侵事件五、漏洞复现--Redis CrackIT入侵事件5.1、以root启动的redis,可以远程登入到redis console--------A主机5.2、生成公钥5.3、执行: redis-cli flushall 清空redis(非常暴力&#xff0…

2023年春秋杯网络安全联赛 春季赛 wp

文章目录 Cryptocheckinbackdoor WebPhpstudyEasypyezrustqqcms MISCSudohappy2forensic盲人会藏在哪里piphackwordle PWNp2048easy_LzhiFTP_CHELL Crypto checkin 第一部分求解一下pell函数得到x,y def solve_pell(N, numTry 100):a[]b[]cf continued_fraction(sqrt(N))f…

C++的priority_queue

priority_queue 1.priority_queue的介绍2.priority_queue的使用3.priority的模拟实现 1.priority_queue的介绍 优先队列是一种堆,默认是大根堆,可以通过greater的仿函数可以建立小根堆empty():检测容器是否为空 size():返回容器中…

【密码学复习】第七章 公钥加密体制(二)

RSA单向陷门函数及其应用 ElGamal单向陷门函数 1)密钥生成 ① 选择一大素数p,选取Zp * 的生成元g ; ② 任选小于p的随机数x,计算y≡g x mod p; ③(y, g, p)为公开密钥, (x, g, p)为秘密密钥. 2)加密:设待加密…

asp.net就业满意度问调查系统

本系统主要有会员(调查者)和管理员,他们具体的功能如下: 会员功能:注册,登录,修改个人信息,调查,查看调查结果及影响,留言,首先是会员注册,注册后…

【Web开发】Node实现Web图表功能(ECharts.js,React)

🎈🎈🎈Python实现Web图表功能系列:🎈🎈🎈1🎈【Web开发】Python实现Web图表功能(D-Tale入门)🎈2🎈【Web开发】Python实现Web图表功能&a…

整理了一份github上比较热门的ChatGPT项目,值得收藏

ChatGPT已经火了一段时间了,但是,热度依旧是各大自媒体的热榜。由于,国内不能直接访问ChatGPT,国内的开发者依托OpenAI的接口,开发出一些ChatGPT的应用。今天就整理一下github上最热门的ChatGPT项目。 lencx/ChatGPT 该项目是Cha…

java线程的状态

文章目录 1. 线程的状态2. 验证NEW、RUNNALE和TERMINATED状态3. 验证TIMED_WAITING状态4. 验证BLOCKED状态5. 验证BLOCKED状态 1. 线程的状态 线程在不同的运行时期存在不同的状态,状态信息存在于State枚举类中,如下图: 调用线程有关的方法是…

文心一言 VS 讯飞星火 VS chatgpt (18)-- 算法导论4.1 5题

五、使用如下思想为最大子数组问题设计一个非递归的、线性时间的算法。从数组的左边界开始,由左至右处理,记录到目前为止已经处理过的最大子数组。若已知 A[1…j]门的最大子数组,基于如下性质将解扩展为 A[1…j1]的最大子数组:A[1…j1]的最大…

Squid 代理服务器

Squid概述 Squid 主要提供缓存加速、应用层过滤控制的功能。 代理的工作机制 1.代替客户机向网站请求数据,从而可以隐藏用户的真实IP地址。 2.将获得的网页数据(静态 Web 元素)保存到缓存中并发送给客户机&#xff0…

Windows安装Ubuntu双系统

Windows安装Ubuntu双系统 1.下载Ubuntu 16.04,地址https://releases.ubuntu.com/16.04/ 2.下载Rufus,地址https://rufus.ie/zh/ 3.准备U盘,烧录系统 4.磁盘分区 5.重启,按住shift键 本人电脑是联想小新 Windows11系统&#xff0…

QT上位机串口+STM32单片机项目

第一个自己的上位机小项目,嘿嘿,还是有些成绩感的。 目录 1.先看QT上位机部分 1.首先写一个页面 2.mainwindow.cpp主要函数。 2.form.cpp主要函数 3.STM32部分 1.main函数 3.QT完整代码 1.shangwei.pro 2.form.h 3.mainwindow.h 4.form.cpp …

从零入门激光SLAM(十一)——如何求解SLAM问题

大家好呀,我是一个SLAM方向的在读博士,深知SLAM学习过程一路走来的坎坷,也十分感谢各位大佬的优质文章和源码。随着知识的越来越多,越来越细,我准备整理一个自己的激光SLAM学习笔记专栏,从0带大家快速上手激…

(转载)从0开始学matlab(第9天)—第一阶段总结

1.编程实例 下面的例子将向大家介绍如何用 MATLAB 解决问题。 例1 温度转换程序 问题: 设计一个 MATLAB 程序,读取一个华氏温度的输入,输出开尔文温度。 答案: 华氏温度和开尔文温度的转换关系式可在物理学课本中找到。其关系式…

HCIP-RIP双向重发布综合实验

拓扑结构: 要求: 1、两个协议间进行多点双向重发布 2、R7的环回没有宣告在OSPF协议中,而是在后期重发布进入的 3、解决环路,所有路径选择最优,且存在备份 4、R2的环回要在RIP中宣告,R3的环回要在OSPF中宣…

如何优雅的写C#,使用Visual studio

免责声明 本人接触C#,.Net一年时间,本文内容基于我平时对于C#语法的积累,如有问题请多包涵。以下内容除了C#之外,还有Visual studio编译器相关的内容。 在使用C#的一年多里面,我发现C#的语法糖真的很不错,Visual Stu…

SaaS系统用户权限设计

SaaS系统用户权限设计 学习目标: 理解RBAC模型的基本概念及设计思路 了解SAAS-HRM中权限控制的需求及表结构分析完成组织机构的基本CRUD操作 完成用户管理的基本CRUD操作完成角色管理的基本CRUD操作 组织机构管理 需求分析 需求分析 实现企业组织结构管理&#xff0…

PCB 基础~典型的PCB设计流程,典型的PCB制造流程

典型的PCB设计流程 典型的PCB制造流程 • 从客户手中拿到Gerber, Drill以及其它PCB相关文件 • 准备PCB基片和薄片 – 铜箔的底片会被粘合在基材上 • 内层图像蚀刻 – 抗腐蚀的化学药水会涂在需要保留的铜箔上(例如走线和过孔) – 其他药水…

如何封装React无限滚动加载列表组件【含源码】

前言 由于需要考虑后端接口的性能问题,我们在请求业务数据列表的时候并不能直接请求全量数据。所以我们在请求数据时常见的方式是做分页查询。 对于前端交互而言,我们需要考虑如何优雅的让用户触发请求下一页数据的接口。常用的方法有两种:…

i春秋春季赛2023

只有两道逆向和一道misc,其他的有时间再写 wordle 不断筛有什么和没什么字母猜就行了 [6x] Guess a 5-letter word : first first [5x] Guess a 5-letter word : ideas Please enter a real English word that exists. [5x] Guess a 5-letter word : icily first…