北邮22信通:二叉树各种遍历所有常见算法汇总

news2024/9/20 20:29:11

北邮22信通一枚~   

跟随课程进度每周更新数据结构与算法的代码和文章 

持续关注作者  解锁更多邮苑信通专属代码~

获取更多文章  请访问专栏~

北邮22信通_青山如墨雨如画的博客-CSDN博客

目录

1.二叉树的前序遍历

1.1递归算法

1.2非递归算法

1.2.1模板类实现栈  

1.2.2模板类实现栈的优化算法

 1.2.3 STL栈

2.二叉树的中序遍历

2.1递归算法

2.2非递归算法

2.2.1模板类实现栈

2.2.2模板类实现栈的优化算法

2.2.3 STL栈

3.二叉树的后序遍历

3.1递归算法

3.2非递归算法

3.3说明

4.层序遍历

5.模板类实现栈完整代码

5.1代码部分

5.2运行结果

 6.STL实现栈完整代码

6.1代码部分

6.2运行结果:


1.二叉树的前序遍历

1.1递归算法

template<class temp>
void bintree<temp>::preorder(binnode<temp>* r)
{
	if (r != NULL)
	{
		cout << r->data;
		preorder(r->leftchild);
		preorder(r->rightchild);
	}
}

1.2非递归算法

1.2.1模板类实现栈  

栈顶元素永远为当前元素的父节点,设r为当前访问的节点,则

1.若r!=NULL,访问r(cout<<s[top].r->data;)并入栈(s[++top].r=r;),调用r=r->leftchild;将r标记为1(s[top].tag=1;)返回1;

2.若r==NULL,重新设r为栈顶元素

        2.1若r标记为2,说明右子树返回;r出栈,重新设r为栈顶元素(top--;),返回2.1;

        2.2若r标记为1,说明左子树返回;调用r=r->rightchild;将r标记为2(s[top].tag=2;),返回1;

反复执行,直到栈空(top==-1),程序结束。

if(r!=NULL)

{

cout<<r->data;入栈

}

if(r==NULL)

        1.不出栈,换右支

        2.出栈

template<class temp>
void bintree<temp>::stackpreorder(binnode<temp>* r)
{
	linkstack<temp> s[100];//栈
	int top = -1;//栈顶指针
	do
	{
		while (r != NULL)//入栈并访问,设置为左子树
		{
			s[++top].r = r;
			s[top].tag = 1;
			cout << s[top].r->data;
			r = r->leftchild;
		}
		while ((top != -1) && s[top].tag == 2)//出栈
			top--;
		if ((top != -1) && (s[top].tag == 1))
		{
            //设置栈顶访问右子树
			r = s[top].r->rightchild;
			s[top].tag = 2;
		}
	} while (top != -1);
}

1.2.2模板类实现栈的优化算法

        当前节点,访问完其左子树之后,依靠当前结点找到右子树,之后当前节点不再提供信息,等待出栈;可以提前让当前结点出栈,简化递归过程。

算法优化:

if(r!=NULL)

{

        cout<<r->data;入栈

}

if(R==NULL)

        出栈,换右支

template<class temp>
void bintree<temp>::quickstackpreorder(binnode<temp>* r)
{
	linkstack<binnode<temp>*>s;
	while (!s.empty() || (r != NULL))
	{
		if (r != NULL)
		{
			cout << r->data;
			s.push(r);
			r = r->leftchild;
		}
		else
		{
			r = s.pop();
			r = r->rightchild;
		}
	}
}

 1.2.3 STL栈

template<class temp>
void bintree<temp>::quickSTLpreorder(binnode<temp>* r)
{
	stack<binnode<temp>*>s;
	while (!s.empty() || (r != NULL))
	{
		if (r != NULL)
		{
			cout << r->data;
			s.push(r);
			r = r->leftchild;
		}
		else
		{
			r = s.top();
			s.pop();
			r = r->rightchild;
		}
	}
}

2.二叉树的中序遍历

2.1递归算法

template<class temp>
void bintree<temp>::inorder(binnode<temp>* r)
{
	if (r != NULL)
	{
		inorder(r->leftchild);
		cout << r->data;
		inorder(r->rightchild);
	}
}

2.2非递归算法

2.2.1模板类实现栈

栈顶元素永远为当前元素的父节点,设r为当前访问的节点,则

1.若r!=NULL,r入栈(s[++top].r=r;),调用r=r->leftchild;将r标记为1(s[top].tag=1;),返回1;

2.若r==NULL,重新设r为栈顶元素

        2.1若r标记为2,说明右子树返回;r出栈,重新设r为栈顶元素(top--;),返回2.1;

        2.2若r标记为1,说明左子树返回;调用r=r->rightchild;访问r(cout<<s[top].r->data;)并将r标记为2(s[top].tag=2;),返回1;

反复执行,直到栈空(top==-1),程序结束。

if(r!=NULL)

{

        入栈;

}

if(r==NULL)

        1:cout<<r->data;不出栈,换右支;

        2:出栈

template<class temp>
void bintree<temp>::stackinorder(binnode<temp>* r)
{
	linkstack<temp> s[100];
	int top = -1;
	do
	{
		while (r != NULL)
		{
			s[++top].r = r;
			s[top].tag = 1;
			r = r->leftchild;
		}
		while ((top != -1) && (s[top].tag == 2))
			top--;
		if ((top != -1) && (s[top].tag == 1))
		{
			r = s[top].r->rightchild;
			cout << s[top].r->data;
			s[top].tag = 2;
		}
	} while (top != -1);
}

2.2.2模板类实现栈的优化算法

        当前节点,访问完其左子树之后,依靠当前结点找到右子树,之后当前节点不再提供信息,等待出栈;可以提前让当前结点出栈,简化递归过程。

算法优化

if(r!=NULL)

{

        入栈;

}

if(r==NULL)

{

        cout<<r->data;

        出栈,换右支;

}

template<class temp>
void bintree<temp>::quickstackinorder(binnode<temp>* r)
{
	linkstack<binnode<temp>*>s;
	while (!s.empty() || r != NULL)
	{
		if (r != NULL)
		{
			s.push(r);
			r = r->leftchild;
		}
		else
		{
			r = s.pop();
			cout << r->data;
			r = r->rightchild;
		}
	}
}

2.2.3 STL栈

template<class temp>
void bintree<temp>::quickSTLinorder(binnode<temp>* r)
{
	stack<binnode<temp>*>s;
	while (!s.empty() || (r != NULL))
	{
		if (r != NULL)
		{
			s.push(r);
			r = r->leftchild;
		}
		else
		{
			r = s.top();
			s.pop();
			cout << r->data;
			r = r->rightchild;
		}
	}
}

3.二叉树的后序遍历

3.1递归算法

template<class temp>
void bintree<temp>::postorder(binnode<temp>* r)
{
	if (r != NULL)
	{
		postorder(r->leftchild);
		postorder(r->rightchild);
		cout << r->data;
	}
}

3.2非递归算法

栈顶元素永远为当前元素的父节点,设r为当前访问的节点,则

1.若r!=NULL,r入栈(s[++top].r=r;),调用r=r->leftchild;将r标记为1(s[top].tag=1;),返回1;

2.若r==NULL,重新设r为栈顶元素

        2.1若r标记为2,说明右子树返回;访问r(cout<<s[top].r->data;)r出栈,重新设r为栈顶元素(top--;),返回2.1;

        2.2若r标记为1,说明左子树返回;调用r=r->rightchild;将r标记为2(s[top].tag=2;),返回1;

反复执行,直到栈空(top==-1),程序结束。

if(r!=NULL)

{

        入栈;

}

if(r==NULL)

        1:不出栈,换右支;

        2:cout<<r->data;出栈

template<class temp>
void bintree<temp>::stackpostorder(binnode<temp>* r)
{
	linkstack<temp> s[100];
	int top = -1;
	do
	{
		while (r != NULL)
		{
			s[++top].r = r;
			s[top].tag = 1;
			r = r->leftchild;
		}
		while ((top != -1) && (s[top].tag == 2))
		{
			cout << s[top].r->data;
			top--;
		}
		if ((top != -1) && (s[top].tag == 1))
		{
			r = s[top].r->rightchild;
			s[top].tag = 2;
		}
	} while (top != -1);
}

3.3说明

        非递归遍历的优化算法核心是:因为根节点的作用是索引左子树,所以访问完左子树之后根节点就没有意义了,所以可以跳过根节点直接访问右子树,从而减小了时间复杂度。但是在后序遍历中,根节点最后访问,所以没有相应的优化算法。

4.层序遍历

层序遍历请看这篇文章  有详细讲解~

北邮22信通:二叉树层序遍历的两种方法&&首发模板类交互_青山如墨雨如画的博客-CSDN博客

5.模板类实现栈完整代码

下面给出模板类实现栈的完整代码。

5.1代码部分

#include<iostream>
using namespace std;
#define MAXSIZE 100005

class student
{
private:
	int ID;
	string name;
public:
	int existence;
	student()
	{
		this->ID = 0;
		this->name = "unknown name";
		this->existence = 0;
	}
	student(int ID, string name)
	{
		this->ID = ID;
		this->name = name;
		this->existence = 1;
	}
	friend ostream& operator<<(ostream& output, student& s)
	{
		output << s.ID << " " << s.name << endl;
		return output;
	}
};

template<class temp>
struct binnode;
//栈
template <class temp>
struct node
{
	temp data;
	node<temp>* next;
};

template <class temp>
class linkstack
{
public:
	binnode<temp>* r;
	int tag;
	linkstack() { top = NULL; }
	~linkstack();
	void push(temp x);
	temp pop();
	temp gettop();
	bool empty()
	{
		return top == NULL ? true : false;
	}
private:
	node<temp>* top;
};

template <class temp>
void linkstack<temp>::push(temp x)
{
	node<temp>* p = new node<temp>;
	p->data = x;
	p->next = this->top;
	this->top = p;
}

template<class temp>
temp linkstack<temp>::pop()
{
	if (empty())throw "下溢";
	temp x = this->top->data;
	node<temp>* p = this->top;
	this->top = this->top->next;
	delete p;
	return x;
}

template<class temp>
linkstack<temp>::~linkstack()
{
	while (this->top != NULL)
	{
		node<temp>* p = this->top;
		this->top = this->top->next;
		delete p;
	}
}

template<class temp>
temp linkstack<temp>::gettop()
{
	if (empty())throw"下溢";
	return this->top->data;
}

//二叉树
template<class temp>
struct binnode
{
	temp data;
	binnode<temp>* leftchild;
	binnode<temp>* rightchild;
};

template<class temp>
class bintree
{
private:
	void create(binnode<temp>*& r, temp data[], int i, int n);
	void release(binnode<temp>* r);
public:
	binnode<temp>* root;
	bintree(temp data[], int n);
	void preorder(binnode<temp>* r);
	void stackpreorder(binnode<temp>* r);
	void quickstackpreorder(binnode<temp>* r);
	void inorder(binnode<temp>* r);
	void stackinorder(binnode<temp>* r);
	void quickstackinorder(binnode<temp>* r);
	void postorder(binnode<temp>* r);
	void stackpostorder(binnode<temp>* r);
	void levelorder(binnode<temp>* r);

	~bintree();
};

template<class temp>
void bintree<temp>::create(binnode<temp>*& r, temp data[], int i, int n)
{
	if (i <= n && data[i - 1].existence != 0)
	{
		r = new binnode<temp>;
		r->data = data[i - 1];
		r->leftchild = r->rightchild = NULL;
		create(r->leftchild, data, 2 * i, n);
		/*书上代码错误1:向函数传入实参时少传入一个n*/
		create(r->rightchild, data, 2 * i + 1, n);/*书上代码错误同上*/
	}
}

template<class temp>
bintree<temp>::bintree(temp data[], int n)
{
	create(this->root, data, 1, n);
}

template<class temp>
void bintree<temp>::preorder(binnode<temp>* r)
{
	if (r != NULL)
	{
		cout << r->data;
		preorder(r->leftchild);
		preorder(r->rightchild);
	}
}

template<class temp>
void bintree<temp>::stackpreorder(binnode<temp>* r)
{
	linkstack<temp> s[100];
	int top = -1;
	do
	{
		while (r != NULL)
		{
			s[++top].r = r;
			s[top].tag = 1;
			cout << s[top].r->data;
			r = r->leftchild;
		}
		while ((top != -1) && s[top].tag == 2)
			top--;
		if ((top != -1) && (s[top].tag == 1))
		{
			r = s[top].r->rightchild;
			s[top].tag = 2;
		}
	} while (top != -1);
}

template<class temp>
void bintree<temp>::quickstackpreorder(binnode<temp>* r)
{
	linkstack<binnode<temp>*>s;
	while (!s.empty() || (r != NULL))
	{
		if (r != NULL)
		{
			cout << r->data;
			s.push(r);
			r = r->leftchild;
		}
		else
		{
			r = s.pop();
			r = r->rightchild;
		}
	}
}

template<class temp>
void bintree<temp>::inorder(binnode<temp>* r)
{
	if (r != NULL)
	{
		inorder(r->leftchild);
		cout << r->data;
		inorder(r->rightchild);
	}
}

template<class temp>
void bintree<temp>::stackinorder(binnode<temp>* r)
{
	linkstack<temp> s[100];
	int top = -1;
	do
	{
		while (r != NULL)
		{
			s[++top].r = r;
			s[top].tag = 1;
			r = r->leftchild;
		}
		while ((top != -1) && (s[top].tag == 2))
			top--;
		if ((top != -1) && (s[top].tag == 1))
		{
			r = s[top].r->rightchild;
			cout << s[top].r->data;
			s[top].tag = 2;
		}
	} while (top != -1);
}

template<class temp>
void bintree<temp>::quickstackinorder(binnode<temp>* r)
{
	linkstack<binnode<temp>*>s;
	while (!s.empty() || r != NULL)
	{
		if (r != NULL)
		{
			s.push(r);
			r = r->leftchild;
		}
		else
		{
			r = s.pop();
			cout << r->data;
			r = r->rightchild;
		}
	}
}

template<class temp>
void bintree<temp>::postorder(binnode<temp>* r)
{
	if (r != NULL)
	{
		postorder(r->leftchild);
		postorder(r->rightchild);
		cout << r->data;
	}
}

template<class temp>
void bintree<temp>::stackpostorder(binnode<temp>* r)
{
	linkstack<temp> s[100];
	int top = -1;
	do
	{
		while (r != NULL)
		{
			s[++top].r = r;
			s[top].tag = 1;
			r = r->leftchild;
		}
		while ((top != -1) && (s[top].tag == 2))
		{
			cout << s[top].r->data;
			top--;
		}
		if ((top != -1) && (s[top].tag == 1))
		{
			r = s[top].r->rightchild;
			s[top].tag = 2;
		}
	} while (top != -1);
}

template<class temp>
void bintree<temp>::levelorder(binnode<temp>* R)
{
	binnode<temp>* queue[MAXSIZE];
	int f = 0, r = 0;
	if (R != NULL)
		queue[++r] = R;//根节点入队
	while (f != r)
	{
		binnode<temp>* p = queue[++f];//队头元素入队
		cout << p->data;//出队打印
		if (p->leftchild != NULL)
			queue[++r] = p->leftchild;//左孩子入队
		if (p->rightchild != NULL)
			queue[++r] = p->rightchild;//右孩子入队
	}
}

template <class temp>
void bintree<temp>::release(binnode<temp>* r)
{
	if (r != NULL)
	{
		release(r->leftchild);
		release(r->rightchild);
		delete r;
	}
}

template<class temp>
bintree<temp>::~bintree()
{
	release(this->root);
}

int main()
{

	system("color 0A");
	student stu[5] = { {1,"zhang"},{2,"wang"},{3,"li"},{4,"zhao"},{5,"liu"} };
	bintree<student>bintreee(stu, 5);
	cout << "前序遍历:" << endl;
	bintreee.preorder(bintreee.root);
	cout << endl << "模板类实现栈前序遍历:" << endl;
	bintreee.stackpreorder(bintreee.root);
	cout << endl << "栈快排前序遍历:" << endl;
	bintreee.quickstackpreorder(bintreee.root);

	cout << endl << "中序遍历:" << endl;
	bintreee.inorder(bintreee.root);
	cout << endl << "模板类实现栈中序遍历:" << endl;
	bintreee.stackinorder(bintreee.root);
	cout << endl << "栈快排中序遍历" << endl;
	bintreee.quickstackinorder(bintreee.root);

	cout << endl << "后序遍历:" << endl;
	bintreee.postorder(bintreee.root);
	cout << endl << "模板类实现栈后序遍历:" << endl;
	bintreee.stackpostorder(bintreee.root);

	cout << endl << "层序遍历:" << endl;
	bintreee.levelorder(bintreee.root);
	cout << endl;
	return 0;
}

5.2运行结果

5.2.1代码效果图:

 5.2.2运行结果:

 6.STL实现栈完整代码

6.1代码部分

#include<iostream>
#include<stack>
using namespace std;
#define MAXSIZE 100005

class student
{
private:
	int ID;
	string name;
public:
	int existence;
	student()
	{
		this->ID = 0;
		this->name = "unknown name";
		this->existence = 0;
	}
	student(int ID, string name)
	{
		this->ID = ID;
		this->name = name;
		this->existence = 1;
	}
	friend ostream& operator<<(ostream& output, student& s)
	{
		output << s.ID << " " << s.name << endl;
		return output;
	}
};

//二叉树
template<class temp>
struct binnode
{
	temp data;
	binnode<temp>* leftchild;
	binnode<temp>* rightchild;
};

template<class temp>
class bintree
{
private:
	void create(binnode<temp>*& r, temp data[], int i, int n);
	void release(binnode<temp>* r);
public:
	binnode<temp>* root;
	bintree(temp data[], int n);
	void preorder(binnode<temp>* r);
	void quickSTLpreorder(binnode<temp>* r);
	void inorder(binnode<temp>* r);
	void quickSTLinorder(binnode<temp>* r);
	void postorder(binnode<temp>* r);
	void levelorder(binnode<temp>* r);

	~bintree();
};

template<class temp>
void bintree<temp>::create(binnode<temp>*& r, temp data[], int i, int n)
{
	if (i <= n && data[i - 1].existence != 0)
	{
		r = new binnode<temp>;
		r->data = data[i - 1];
		r->leftchild = r->rightchild = NULL;
		create(r->leftchild, data, 2 * i, n);
		/*书上代码错误1:向函数传入实参时少传入一个n*/
		create(r->rightchild, data, 2 * i + 1, n);/*书上代码错误同上*/
	}
}

template<class temp>
bintree<temp>::bintree(temp data[], int n)
{
	create(this->root, data, 1, n);
}

template<class temp>
void bintree<temp>::preorder(binnode<temp>* r)
{
	if (r != NULL)
	{
		cout << r->data;
		preorder(r->leftchild);
		preorder(r->rightchild);
	}
}

template<class temp>
void bintree<temp>::quickSTLpreorder(binnode<temp>* r)
{
	stack<binnode<temp>*>s;
	while (!s.empty() || (r != NULL))
	{
		if (r != NULL)
		{
			cout << r->data;
			s.push(r);
			r = r->leftchild;
		}
		else
		{
			r = s.top();
			s.pop();
			r = r->rightchild;
		}
	}
}

template<class temp>
void bintree<temp>::inorder(binnode<temp>* r)
{
	if (r != NULL)
	{
		inorder(r->leftchild);
		cout << r->data;
		inorder(r->rightchild);
	}
}

template<class temp>
void bintree<temp>::quickSTLinorder(binnode<temp>* r)
{
	stack<binnode<temp>*>s;
	while (!s.empty() || (r != NULL))
	{
		if (r != NULL)
		{
			s.push(r);
			r = r->leftchild;
		}
		else
		{
			r = s.top();
			s.pop();
			cout << r->data;
			r = r->rightchild;
		}
	}
}

template<class temp>
void bintree<temp>::postorder(binnode<temp>* r)
{
	if (r != NULL)
	{
		postorder(r->leftchild);
		postorder(r->rightchild);
		cout << r->data;
	}
}

template<class temp>
void bintree<temp>::levelorder(binnode<temp>* R)
{
	binnode<temp>* queue[MAXSIZE];
	int f = 0, r = 0;
	if (R != NULL)
		queue[++r] = R;//根节点入队
	while (f != r)
	{
		binnode<temp>* p = queue[++f];//队头元素入队
		cout << p->data;//出队打印
		if (p->leftchild != NULL)
			queue[++r] = p->leftchild;//左孩子入队
		if (p->rightchild != NULL)
			queue[++r] = p->rightchild;//右孩子入队
	}
}

template <class temp>
void bintree<temp>::release(binnode<temp>* r)
{
	if (r != NULL)
	{
		release(r->leftchild);
		release(r->rightchild);
		delete r;
	}
}

template<class temp>
bintree<temp>::~bintree()
{
	release(this->root);
}

int main()
{

	system("color 0A");
	student stu[5] = { {1,"zhang"},{2,"wang"},{3,"li"},{4,"zhao"},{5,"liu"} };
	bintree<student>bintreee(stu, 5);
	cout << "前序遍历:" << endl;
	bintreee.preorder(bintreee.root);
	cout << endl << "STL前序遍历:" << endl;
	bintreee.quickSTLpreorder(bintreee.root);

	cout << endl << "中序遍历:" << endl;
	bintreee.inorder(bintreee.root);
	cout << endl << "STL中序遍历" << endl;
	bintreee.quickSTLinorder(bintreee.root);

	cout << endl << "后序遍历:" << endl;
	bintreee.postorder(bintreee.root);

	cout << endl << "层序遍历:" << endl;
	bintreee.levelorder(bintreee.root);
	cout << endl;
	return 0;
}

6.2运行结果:

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

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

相关文章

负载均衡的综合部署练习(LVS-DR模式+Nginx七层反向代理+Tomcat多实例)

1.实验设计 实验所满足的需求 满足某公司&#xff0c;想搭建一套高可用的负载均衡DR模式的集群&#xff0c;同时该集群收到用户访问请求时能够自主判断用户发送的请求是动态资源还是静态&#xff0c;依次划分进行动静分离&#xff1a;Nginx处理静态资源&#xff0c;Tomcat处理…

图的数据结构,系统学习图的基本概念、定义和建立,学会邻接矩阵、邻接表以及实现六度空间案例,遍历图的方式——广度、深度访问

1.图的定义和术语 图&#xff1a;G (V,E) Graph (Vertex, Edge) V&#xff1a;顶点&#xff08;数据元素&#xff09;的有穷非空集合&#xff1b; E&#xff1a;边的有穷集合。 有向图&#xff1a;每条边都是有方向的 无向图&#xff1a;每条边都是无方向的 完全图&#…

用 ChatGPT 进行阅读理解题目的问答

阅读理解出题 阅读理解题是语言学习过程中一种重要的练习方式。无论语文还是英语考试中&#xff0c;阅读理解题都占有相当大的分值。ChatGPT 作为一种大语言模型&#xff0c;在处理自然语言理解任务中具有很大的优势。广大教师和学生家长们&#xff0c;都可以尝试用 ChatGPT 进…

借灰姑娘的手,讲述js混淆加密的美丽

这个故事的主角是灰姑娘&#xff0c;她有一个重要的秘密&#xff0c;需要将其保护起来。但是&#xff0c;她发现她的网站上的 JavaScript 代码很容易被其他人阅读和修改&#xff0c;为了保护这个秘密&#xff0c;她需要采用一些混淆和加密技术。 以下是她使用的一些技术&#…

数据结构与算法学习:二叉树的后序遍历的递归与非递归实现,以及非递归实现中的流程控制的说明。

需求二叉树&#xff1a; 采用二叉树后序遍历非递归算法。设置一个指针p初始指向树根&#xff0c;p先入栈&#xff0c;而后使得p指向它的左孩子p->firstchild&#xff0c;重复操作&#xff0c;使得每个左孩子都依次入栈&#xff0c;同时初始化一个Treenode*类型的指针pre&…

GPT:你知道这五年我怎么过的么?

时间轴 GPT 首先最初版的GPT&#xff0c;来源于论文Improving Language Understanding by Generative Pre-Training&#xff08;翻译过来就是&#xff1a;使用通用的预训练来提升语言的理解能力&#xff09;。GPT这个名字其实并没有在论文中提到过&#xff0c;后人将论文名最后…

【软件测试】知识图

文章目录 第1章 软件测试概述1.1 软件、软件危机和软件工程1.1.1 基本概念1.1.2 软件工程的目标及其一般开发过程1.1.3 软件过程模型 1.2 软件缺陷与软件故障1.2.1 基本概念1.2.2 典型案例 1.3 软件测试的概念1.3.1 软件测试的定义1.3.2 软件测试的目的&#xff1a;保证软件产品…

备忘录设计模式解读

目录 问题引进 游戏角色状态恢复问题 传统方案解决游戏角色恢复 传统的方式的问题分析 备忘录模式基本介绍 基本介绍 备忘录模式的原理类图 对原理类图的说明 游戏角色恢复状态实例 应用实例要求 思路分析和图解(类图) 代码实战 备忘录模式的注意事项和细节 问题引…

了解网络攻击:类型、策略和技术

近年来&#xff0c;网络攻击变得越来越普遍&#xff0c;个人和企业都成为各种网络威胁的受害者。了解不同类型的网络攻击&#xff0c;以及网络罪犯使用的策略和技术&#xff0c;对于保护您的个人和企业数据免受这些威胁至关重要。 有几种不同类型的网络攻击&#xff0c;每种都…

Linux 查看进程和线程CPU和内存占用情况

文章目录 Linux 查看进程有哪些线程Linux 查看程序内存占用情况 top和free等命令Linux 查看进程、线程数量 Linux 查看进程有哪些线程 linux 下查看进程内的线程有哪些 首先通过进程名称&#xff0c;假设为SensorDev 找到pid号。 ps -p {pid} -T 可以得到该进程里面运行的各…

Mapbox多边形光效晕影特效的实现

相信很多大屏需要展示行政区的发光效果,像下图这样的: 这相比普通的多边形样式,边界有了渐变发光的效果,那么这篇章交给大家如何实现这样一个效果,让你的行政区,地块之类的多边形要素展示成发光的效果。 我们不依赖底层的webgl技术,也不用涉及到什么着色器的概念,我…

【LeetCode: 1143. 最长公共子序列 | 暴力递归=>记忆化搜索=>动态规划】

&#x1f680; 算法题 &#x1f680; &#x1f332; 算法刷题专栏 | 面试必备算法 | 面试高频算法 &#x1f340; &#x1f332; 越难的东西,越要努力坚持&#xff0c;因为它具有很高的价值&#xff0c;算法就是这样✨ &#x1f332; 作者简介&#xff1a;硕风和炜&#xff0c;…

Springcloud连接nacos集群,nacos地址配置为nginx,报错:requst nacos server failed

先说下版本&#xff1a; Spring cloud&#xff1a; Hoxton.SR12 spring.cloud.alibaba&#xff1a; 2.2.9.RELEASE spring.boot&#xff1a; 2.3.12.RELEASE Linux Centos7 nacos-server&#xff1a;2.1.0 nginx&#xff1a; 1.20.2 环境说明&#xff1a; nacos正常搭建三个集…

Burpsuite双层代理以及抓https与app包设置

Burp Suite是一款用于Web应用程序安全测试的集成式平台。它由PortSwigger Ltd.开发&#xff0c;是一个功能强大的工具&#xff0c;用于发现Web应用程序的漏洞和安全问题&#xff0c;例如跨站点脚本&#xff08;XSS&#xff09;、SQL注入、会话劫持等。它包括多个模块&#xff0…

酒厂酒业IP网络广播系统建设方案-基于局域网的新一代交互智慧酒厂酒业IP广播设计指南

酒厂酒业IP网络广播系统建设方案-基于局域网的新一代交互智酒业酒厂IP广播系统设计指南 由北京海特伟业任洪卓发布于2023年4月25日 一、酒厂酒业IP网络广播系统建设需求 随着中国经济的快速稳步发展&#xff0c;中国白酒行业也迎来了黄金时期&#xff0c;产品规模、销售业绩等…

NLP 与 Python:构建知识图谱实战案例

概括 积累了一两周&#xff0c;好久没做笔记了&#xff0c;今天&#xff0c;我将展示在之前两周的实战经验&#xff1a;如何使用 Python 和自然语言处理构建知识图谱。 网络图是一种数学结构&#xff0c;用于表示点之间的关系&#xff0c;可通过无向/有向图结构进行可视化展示…

【2023团体程序设计天梯赛CCCC】GPLT2023,L1~L2部分(PTA,L1-089~L1-096,L2-045~L2-048)题解代码复盘

文章目录 概要L1-089 最好的文档 5L1-090 什么是机器学习 5L1-091 程序员买包子 10L1-092 进化论 10L1-093 猜帽子游戏 15L1-094 剪切粘贴 15L1-095 分寝室 20L1-096 谁管谁叫爹 20L2-045 堆宝塔 25L2-046 天梯赛的赛场安排L2-047 锦标赛 25L2-048 寻宝图 25L3-035 完美树&…

GIII EDI 需求分析

G-III成衣集团是一家美国服装公司&#xff0c;拥有30多个授权和自有品牌如&#xff1a;Calvin Klein、Tommy Hilfiger、Guess以及Levi’s等&#xff0c;在全球拥有众多的零售合作伙伴和销售渠道&#xff0c;并致力于提供时尚、高质量和价格合理的服装产品。 GIII EDI 需求 传…

版本控制工具之Git基本操作

Git 相对较新的版本控制工具&#xff0c;特点为分布式。 每一台客户端都具有完整的版本备份&#xff0c;所有的版本提交都不需要依赖中心服务器。只有在多人协同时&#xff0c;服务器会处理并发情况。 一、Git 环境安装 &#x1f449;链接&#xff1a;https://blog.csdn.net/w…

「速通Shell」初次走近Shell,Shell是什么?

目录 初次走进ShellShell是什么Shell工作原理 Shell分类Shell的优势 第一个Shell脚本Hello WorldShell执行方式绝对路径执行相对路径执行脚本命令执行系统命令执行 总结 对于开发者来说&#xff0c;除了掌握Java、C/C等主要编程语言外&#xff0c;还需要掌握支撑性的工具语言和…