当前位置: 首页 > news >正文

数据结构严蔚敏版精简版-线性表以及c语言代码实现

线性表、栈、队列、串和数组都属于线性结构。线性结构的基本特点是除第一个元素无直接前驱,最后一个元素无直接后继之外,其他每个数据元素都有一个前驱和后继。

1 线性表的定义和特点

如此类由n(n大于等于0)个数据特性相同的元素构成的有限序列称为线性表。 线性表中元素的个数n定义为线性表的长度,n=0时称为空表。

对千非空的线性表或线性结构,其特点是:

(1)存在唯一的一个被称作“第一个"的数据元素;

(2)存在唯一的一个被称作“最后一个"的数据元素;

(3)除第一个之外,结构中的每个数据元素均只有一个前驱;

(4)除最后一个之外,结构中的每个数据元素均只有一个后继。

2 线性表的顺序存储表示

线性表的顺序表示指的是用一组地址连续的存储单元依次存储线性表的数据元素,这种表示 也称作线性表的顺序存储结构或顺序映像。通常,称这种存储结构的线性表为顺序表(Sequential List)。其特点是,逻辑上相邻的数据元素,其物理次序也是相邻的。

2.1顺序表的操作

代码实现:

#include<stdio.h>
#include<stdlib.h>
#include<assert.h>
#include<malloc.h>
#define LONG 8//最大容量 
#define inc 3typedef  int Elemtype;
typedef struct Seqlist{Elemtype *base;//基地址 int capacity;//最大容量 int size;//所含元素的多少 
}Seqlist; bool INC(Seqlist *L){Elemtype *newbase=(Elemtype*)realloc(L->base,sizeof(Elemtype)*(L->capacity+inc));if(newbase==NULL){printf("满了,不能开辟空间");return false;}L->base=newbase;L->capacity+=inc;return true;}
void InitSeqlist(Seqlist *L)//初始化 
{L->base=(Elemtype*)malloc(sizeof(Elemtype)*LONG);assert(L->base !=NULL);L->size=0;L->capacity=LONG;}
void Push_back(Seqlist *L,Elemtype x)//尾插 
{if(L->size>=L->capacity&&!INC(L)){printf("满了");return;}L->base[L->size]=x;L->size++;
}
void show_list(Seqlist *L)//展示 
{for(int i ;i< L->size;i++){printf("%d  ",L->base[i]);}printf("\n");
}
void Push_front(Seqlist *L,Elemtype x)//头插 
{if(L->size>=L->capacity&&!INC(L)){printf("满了,不能头插");return;}for(int i=L->size;i>0;i--){L->base[i]=L->base[i-1];}L->base[0]=x;L->size++;
}
void pop_back(Seqlist *L)//尾部删除 
{if(L->size==0){printf("空表不能尾部删除"); }L->size--;} void pop_front(Seqlist *L)//头部删除 {if(L->size==0){printf("空表不能头部删除"); }for(int i=1;i<L->size;i++) {L->base[i-1]=L->base[i];}L->size--;}
void insert_pos(Seqlist *L,int pos,Elemtype itim)
{if(L->size>=L->capacity){printf("满了,不能按位置插");return;}if(pos<0 || pos>L->size ){printf("位置不和合法"); }for(int i=L->size;i>pos;i--) {L->base[i]=L->base[i-1];}L->base[pos]=itim;L->size++;
}
int find(Seqlist *L,Elemtype x)
{if(L->size==0){printf("空表");return -1;}for(int i=0;i<L->size;i++){if(L->base[i]==x)return i;}return -1;	 
}
int length(Seqlist *L)
{printf("长度为%d,容量为%d",L->size,L->capacity);return L->size;
}
void delete_pos(Seqlist *L,int pos)
{if(pos<0||pos>L->size){printf("位置非法");return;}for(int i=pos;i<L->size;i++){L->base[i]=L->base[i+1];}L->size--;
}
void delete_val(Seqlist *L,int x)
{int pos=find(L,x);if(pos==-1){printf("数据不存在");return;}delete_pos(L,pos);
}void sort(Seqlist *L)
{for(int i=0;i<L->size-1;i++){for(int j=0;j<L->size-i-1;j++){if(L->base[j]>L->base[j+1]){Elemtype tmp=L->base[j];L->base[j]=L->base[j+1];L->base[j+1]=tmp; }}}
}void resver(Seqlist *L)
{int head=0;int rear=L->size-1;while(1){int tmp=L->base[head];L->base[head]=L->base[rear];L->base[rear]=tmp;head++;rear--;if(head>rear)break;}}void clear(Seqlist *L)
{L->size=0;
}void destory(Seqlist *L)
{free(L->base);L->size=NULL;L->capacity=0;L->size=0;}int main1()
{	Seqlist L;InitSeqlist(&L);int setlect=1while(select){printf("************************************\n");printf("* [1]push_back    [2]push_front    *\n");printf("* [3]show_list    [4]pop_back      *\n");printf("* [5]pop_front    [6]insert_pos    *\n");printf("* [7]find         [8]length        *\n");printf("* [9]delete_pos   [10]delete_va    *\n");printf("* [11]sort        [12]resver       *\n");printf("* [13]clear [14]destroy     [0]quit_system   *\n");printf("************************************\n");printf("请选择"); scanf("%d",&select); if(select==0)break;switch(select){case 1:printf("输入插的数据-1结束");while(scanf("%d",&itim),itim !=-1){Push_back(&L,itim);}break;case 2:printf("请输入数据头插");scanf("%d",&itim);Push_front(&L,itim);break;case 3:show_list(&L); break;case 4:pop_back(&L);break;case 5:pop_front(&L);break;case 6:printf("请输入插入数据");scanf("%d",&itim) ;printf("请输入位置");scanf("%d",&pos);insert_pos(&L,pos,itim);break;case 7:printf("输入查找数据");scanf("%d",&itim);pos=find(&L,itim);if(pos>=0)	printf("查找成功%d的位置在%d\n",itim,pos);else			printf("查找%d失败,没有找到\n",itim) ;break;case 8:printf("表的长度为%d\n",length(&L));break;case 9:printf("请输入要删除的位置:");scanf("%d",&pos);delete_pos(&L,pos);break; case 10:printf("请输入要删除的数据:");scanf("%d",&itim);delete_val(&L,itim);break;case 11:sort(&L);break;case 12:resver(&L);break;case 13:clear(&L);break;case 14:destory(&L);break;}	}destory(&L);
}

2.2顺序表的优缺点

顺序表可以随机存取表中任一元素,其存储位置可用一个简单、直观的公式来表示。然而, 从另一方面来看,这个特点也造成了这种存储结构的缺点:在做插入或删除操作时,需移动大量元素。另外由千数组有长度相对固定的静态特性,当表中数据元素个数较多且变化较大时, 操作过程相对复杂,必然导致存储空间的浪费。所有这些问题,都可以通过线性表的另一种表 示方法�式存储结构来解决。

3 线性表的链式表示

用单链表表示线性表时,数据元素之间的逻辑关系是由结点中的指针指示的。换句话说,指 针为数据元素之间的逻辑关系的映像,则逻辑上相邻的两个数据元素其存储的物理位置不要求紧 邻,由此,这种存储结构为非顺序映像或链式映像。

链表增加头结点的作用:

(1)便于首元结点的处理增加了头结点后,首元结点的地址保存在头结点(即其“前驱”结点)的指针域中,则对链表 的第一个数据元素的操作与其他数据元素相同,无需进行特殊处理。

(2)便于空表和非空表的统一处理 当链表不设头结点时,假设L为单链表的头指针,它应该指向首元结点,则当单链表为长度 n为0的空表时,L指针为空。

3.1单链表的操作

包含链表的头插头删,尾差尾删,逆置,排序等操作。

#include<stdio.h>
#include<stdlib.h>
#include<malloc.h>
#include<assert.h>
#define Elemtype int
typedef struct Node
{Elemtype data;struct Node *next;
}Node,*PNode;typedef struct List
{PNode first;//头指针 PNode last;//尾指针 size_t size;
}List;
void Initlist(List *L)//初始化 
{L->first=L->last=(Node*)malloc(sizeof(Node));L->first->next=NULL; L->last->next=NULL; L->size=0; 
}
void push_back(List *L,Elemtype x)//尾插 
{Node *s=(Node*)malloc(sizeof(Node));assert(s!=NULL);s->data=x;s->next=NULL;L->last->next=s;L->last=s;L->size++;
}
void push_front(List *L,Elemtype x)//头插 
{Node *s=(Node*)malloc(sizeof(Node));assert(s!=NULL);s->data=x;s->next=L->first->next;L->first->next=s;if(L->size==0){L->last=s;}L->size++;
}
void show_list(List *L)//打印链表 
{if(L->size==0){printf("为空表");return; }Node *p=L->first->next;while(p!=NULL){printf("%d-->",p->data);p=p->next;}printf("NULL\n");
}void pop_back(List *L)//尾删 
{if(L->size==0){printf("空表");return;}Node *p=L->first;while(p->next !=L->last)p=p->next;free(p->next);L->last=p;L->size--;p->next=NULL;//或L->last->next=NULL; }
void pop_front(List *L)//头删 
{if(L->size==0){printf("空表");return;}Node *p=L->first->next;L->first->next=p->next;free(p);L->size--; if(L->size==1){L->last=L->first;}} 
void insert_val(List *L,Elemtype x)//在排序的链表中插入数据,并使其不变 
{	Node *s=(Node*)malloc(sizeof(Node));s->data=x;s->next=NULL;Node *p=L->first;while(p->next!=NULL && p->next->data<x){p=p->next;}/*printf("%d",p->data);*/if(p->next==NULL){printf("到头了");printf("%d",p->next) ;L->last=s;}s->next=p->next;p->next=s;L->size++;
}
Node* find(List *L,Elemtype key)//查找节点 
{Node *p=L->first->next;while(p!=NULL&&p->data!=key){p=p->next;}return p;
}
int length(List *L)
{return L->size;
}void delete_val(List *L,Elemtype x)//删除指定元素 
{
Node *p=find(L,x);if(L->size==0)return;else if(p==NULL){printf("不存在");return;}else if(p==L->last){	pop_back(L);}else{Node *q=p->next;p->data=q->data;p->next=q->next;free(q);L->size--;}}
void sort(List *L)//链表排序 
{if(L->size==0||L->size==1){return ;}Node *s=L->first->next;Node *q=s->next;L->last=s;L->last->next=NULL;while(q!=NULL)//q为第二段 {int data;data=q->data;printf("%d",data); insert_val(L,data);q=q->next;}
}
void resver(List *L)//链表逆置 
{if(L->size==1||L->size==0)return;Node *s=L->first;Node *q=s->next;L->last=s;L->last->next=NULL;while(q!=NULL)//q为第二段 {int data;data=q->data;//printf("%d",data); push_front(L,data);q=q->next;}
}
void clear(List *L)//清空 
{if(L->size==0)return;Node *p=L->first->next;Node *s=p->next;while(p!=NULL){L->first->next=p->next;free(p);p=L->first->next;}L->last=L->first;L->size=0;
}void destory(List *L)//销毁 
{clear(L);free(L->first);L->first=L->last=NULL;}
int  main()
{List L;Elemtype itim;int pos;Initlist(&L);int select=1;while(select){printf("************************************\n");printf("* [1]push_back    [2]push_front    *\n");printf("* [3]show_list    [4]pop_back      *\n");printf("* [5]pop_front    [6]insert_val    *\n");printf("* [7]find         [8]length        *\n");printf("* [9]delete_val   [10]sort         *\n");printf("* [11]resver      [12]clear        *\n");printf("* [13]destroy     [0]quit_system   *\n");printf("************************************\n");printf("请选择");scanf("%d",&select);if(select==0)break;switch(select){case 1:printf("请输入要出入的数据(-1结束)");while(scanf("%d",&itim),itim!=-1){push_back(&L,itim);}break;case 2:printf("请输入数据头插(-1结束)");while(scanf("%d",&itim),itim!=-1){push_front(&L,itim);}break;case 3:show_list(&L);break;case 4:pop_back(&L);break;case 5:pop_front(&L);break;case 6:printf("请输入数据:");scanf("%d",&itim);insert_val(&L,itim);break;case 7:printf("请输入要查找的数据:");scanf("%d",&itim);if(find(&L,itim)==NULL){printf("不存在"); } else{printf("存在");}break;case 8:printf("大小为%d",length(&L));break;case 9:printf("请输入要删除的数据:");scanf("%d",&itim);delete_val(&L,itim);break;case 10:sort(&L); break;case 11:resver(&L);break; case 12:clear(&L);break;//case 13://	//	break;default:printf("数据不合法");break; }} destory(&L);
} 

3.2单循环链表的操作与实现

包含单循环链表的头插头删,尾差尾删,逆置,排序等操作。

#define  Elemtype int
#include<stdio.h>
#include<malloc.h>
typedef struct Node
{Elemtype data;struct Node *next; 
}Node,*PNode;typedef struct List
{PNode first;PNode last;int size;} List;void initlist(List *L)//初始化 {Node *s=(Node*)malloc(sizeof(Node));L->first=L->last=s;L->last->next=L->first;L->size=0;}Node *_buynode(Elemtype x)//创建节点 {Node *s=(Node*)malloc(sizeof(Node));s->data=x;s->next=NULL;return s;}void show_list(List *L)//打印链表 {Node *p=L->first->next;while(p!=L->first){printf("%d-->",p->data);p=p->next;}}void push_back(List *L,Elemtype x)//尾插 {Node *s=_buynode(x);L->last->next=s;L->last=s;L->last->next=L->first;L->size++; }void push_front(List *L,Elemtype x)//头插 {Node *s=_buynode(x);s->next=L->first->next;L->first->next=s;if(L->size==0){L->last=s;}L->size++;}void pop_front(List *L)//头删 {if(L->size==0)return;Node *s=L->first->next;Node *p=s->next;L->first->next=p;free(s);if(L->size==1){L->last=L->first;}L->size--;}void pop_back(List *L)//尾删 {if(L->size==0){return;}Node *p=L->first;while(p->next!=L->last){p=p->next;}free(p->next);p->next=L->first;L->last=p;L->size--;} 
void insert_val(List *L,Elemtype x)//插入表,使其保持顺序不变 
{Node *p=L->first;while(p->next!=L->last&&p->next->data<x){p=p->next;}if(p->next->next==L->first&&p->next->data<x)//p->next==L->last; 因为L->last->next=L->first; {push_back(L,x);}else{	Node *s=_buynode(x);s->next=p->next;p->next=s;L->size++;}
}
Node* find(List *L,Elemtype x)//查找 
{if(L->size==0)return NULL;Node *p=L->first->next;while(p!=L->first&&p->data!=x){p=p->next;}if(p==L->first){return NULL;}return p;} int length(List *L){return L->size;} void delete_val(List *L,Elemtype x)//指定值删除 {if(L->size==0)return;Node *p=find(L,x);if(p==NULL){printf("不存在");return;} if(p==L->last){pop_back(L);}else{Node *s=p->next;p->data=s->data;p->next=s->next;free(s);L->size--;}}void sort(List *L)//排序 
{	if(L->size==0||L->size==1)return;Node *p=L->first->next;Node *s=p->next;//第二段 L->last->next=NULL;L->last=p;L->last->next=L->first;while(s!=NULL){	Node *z=s->next;;int x=s->data;//	printf("%d",x); insert_val(L,x);L->size--;free(s); s=z;}}
void resver(List *L)//逆置 
{if(L->size==0||L->size==1)return;Node *p=L->first->next;Node *s=p->next;//第二段 L->last->next=NULL;L->last=p;L->last->next=L->first;while(s!=NULL){	Node *z=s->next;;int x=s->data;//	printf("%d",x); push_front(L,x);free(s);L->size--;s=z;}
}
void clear(List *L)//清空 
{Node *p=L->first->next;while(p!=L->first){L->first->next=p->next;free(p);p=L->first->next;}L->size=0;L->last=L->first;L->last->next=L->first;
}
void destory(List *L)//销毁 
{clear(L);free(L->first);free(L->last);L->first=L->last=NULL;
}
int  main()
{List L;Elemtype itim;int pos;initlist(&L);int select=1;while(select){printf("************************************\n");printf("* [1]push_back    [2]push_front    *\n");printf("* [3]show_list    [4]pop_back      *\n");printf("* [5]pop_front    [6]insert_val    *\n");printf("* [7]find         [8]length        *\n");printf("* [9]delete_val   [10]sort         *\n");printf("* [11]resver      [12]clear        *\n");printf("* [13]destroy     [0]quit_system   *\n");printf("************************************\n");printf("请选择");scanf("%d",&select);if(select==0)break;switch(select){case 1:printf("请输入要出入的数据(-1结束)");while(scanf("%d",&itim),itim!=-1){push_back(&L,itim);}break;case 2:printf("请输入数据头插(-1结束)");while(scanf("%d",&itim),itim!=-1){push_front(&L,itim);}break;case 3:show_list(&L);break;case 4:pop_back(&L);break;case 5:pop_front(&L);break;case 6:printf("请输入数据:");scanf("%d",&itim);insert_val(&L,itim);break;case 7:printf("请输入要查找的数据:");scanf("%d",&itim);if(find(&L,itim)==NULL){printf("不存在"); } else{printf("存在");}break;case 8:printf("大小为%d",length(&L));break;case 9:printf("请输入要删除的数据:");scanf("%d",&itim);delete_val(&L,itim);break;case 10:sort(&L); break;case 11:resver(&L);break; case 12:clear(&L);break;//case 13://	//	break;*/default:printf("数据不合法");break; }} destory(&L);
} 

3.3双循环链表的实现

包含双循环链表的头插头删,尾差尾删,逆置,排序等操作。

#include<stdio.h>
#include<malloc.h>
#include<assert.h>
#define Elemtype int
typedef struct Node{Elemtype data;struct Node *next;struct Node *prio;
}Node;typedef struct List{Node *first;//前驱 Node *last;//后继 int size;
}List;Node*  _buynode(Elemtype x)//创建节点 
{Node *p=(Node*)malloc(sizeof(Node));p->data=x;p->next=p->prio=NULL;return p;
}
void InitList(List *L)//初始化 
{Node *s=(Node*)malloc(sizeof(Node));L->first=s;L->first->next=NULL;L->last=s;L->first->prio=L->last;L->last->next=L->first;
}
void show_list(List *L)//打印链表 
{	if(L->size==0){printf("空表");return;}Node *p=L->first->next;while(p!=L->first){printf("%d-->",p->data);p=p->next;}
}void push_back(List *L,Elemtype x)//尾插 
{Node *p=_buynode(x);p->next=L->last->next;p->next->prio=p;p->prio=L->last;L->last->next=p;L->last=p;L->size++;
} 
void push_front(List *L,Elemtype x)//头插 
{Node *p=_buynode(x);p->next=L->first->next;p->next->prio=p;L->first->next=p;p->prio=L->first; if(L->size==0){L->last=p;p->next=L->first;L->first->prio=L->last;}L->size++;
}void pop_back(List *L)//尾删 
{if(L->size==0){return;}Node *p=L->last;L->last=p->prio;p->next->prio=p->prio;p->prio->next=p->next;free(p);L->size--;
}
void pop_front(List *L)//头删 
{if(L->size==0)return;Node *p=L->first->next;p->next->prio=p->prio;p->prio->next=p->next;free(p);if(L->size==1){L->last=L->first;}L->size--;
}void insert_val(List *L,Elemtype x )//有序的链表,插入x后保持有序 
{Node *p=L->first;while(p->next!=L->first&&p->next->data<x)p=p->next;if(p->next==L->first){push_back(L,x);} else{Node *s=_buynode(x);s->next=p->next;s->next->prio=s;s->prio=p;p->next=s;L->size++;}}Node* find(List *L,Elemtype x)//查找 
{Node *p=L->first->next;while(p->next!=L->first&&p->data!=x){p=p->next;}if(p->next==L->first&&p->data!=x)return NULL;return p;
}int length(List *L)
{return L->size;
}void delete_val(List *L,Elemtype x)//删除指定值 
{Node *p=find(L,x);if(p==NULL){return;}else{p->prio->next=p->next;p->next->prio=p->prio;free(p);}L->size--;} void sort(List *L)//排序 {if(L->size==0||L->size==1){return;}Node *s=L->first->next;Node *q=s->next;L->last->next=NULL;L->last=s;L->last->next=L->first;L->first->prio=L->last;while(q!=NULL){s=q;q=q->next;Node *p=L->first->next;while(p->next!=L->last&&p->next->data<s->data)p=p->next;if(p->next==L->last&&p->next->data<s->data){s->next=L->last->next;s->next->prio=s;s->prio=L->last;L->last->next=s;L->last=s;} else{s->next=p->next;s->next->prio=s;s->prio=p;p->next=s;}}}void resver(List *L)//逆置 {if(L->size==0||L->size==1){return;}Node *s=L->first->next;Node *q=s->next;L->last->next=NULL;L->last=s;L->last->next=L->first;L->first->prio=L->last;while(q!=NULL){s=q;q=q->next;s->next=L->first->next;s->next->prio=s;L->first->next=s;s->prio=L->first;}}
void clear(List *L)//清空 
{	if(L->size==0)return;Node *p=L->first->next;while(p!=L->first){p->next->prio=L->first;L->first->next=p->next;free(p);p=L->first->next;L->size--;
}
L->last=L->first ;
}
void destory(List *L)
{clear(L);free(L->first);L->first=L->last=NULL;
}
int  main()
{List L;Elemtype itim;int pos;InitList(&L);int select=1;while(select){printf("************************************\n");printf("* [1]push_back    [2]push_front    *\n");printf("* [3]show_list    [4]pop_back      *\n");printf("* [5]pop_front    [6]insert_val    *\n");printf("* [7]find         [8]length        *\n");printf("* [9]delete_val   [10]sort         *\n");printf("* [11]resver      [12]clear        *\n");printf("* [13]destroy     [0]quit_system   *\n");printf("************************************\n");printf("请选择");scanf("%d",&select);if(select==0)break;switch(select){case 1:printf("请输入要出入的数据(-1结束)");while(scanf("%d",&itim),itim!=-1){push_back(&L,itim);}break;case 2:printf("请输入数据头插(-1结束)");while(scanf("%d",&itim),itim!=-1){push_front(&L,itim);}break;case 3:show_list(&L);break;case 4:pop_back(&L);break;case 5:pop_front(&L);break;case 6:printf("请输入数据:");scanf("%d",&itim);insert_val(&L,itim);break;case 7:printf("请输入要查找的数据:");scanf("%d",&itim);if(find(&L,itim)==NULL){printf("不存在"); } else{printf("存在");}break;case 8:printf("大小为%d",length(&L));break;case 9:printf("请输入要删除的数据:");scanf("%d",&itim);delete_val(&L,itim);break;case 10:sort(&L); break;case 11:resver(&L);break; case 12:clear(&L);break;/*case 13:destory(&L);break;*/default:printf("数据不合法");break; }} //destory(&L);
} 

4 顺序表和链表的比较

4.1空问性能的比较

(1)存储空间的分配 顺序表的存储空间必须预先分配,元素个数扩充受一定限制,易造成存储空间浪费或空间溢出现象;而链表不需要为其预先分配空间,只要内存空间允许,链表中的元素个数就没有限制。 基于此,当线性表的长度变化较大,难以预估存储规模时,宜采用链表作为存储结构。

(2)存储密度的大小 链表的每个结点除了设置数据域用来存储数据元素外,还要额外设置指针域,用来存储指示 元素之间逻辑关系的指针,从存储密度上来讲,这是不经济的。所谓存储密度是指数据元素本身 所占用的存储量和整个结点结构所占用的存储量之比,

存储密度越大,存储空间的利用率就越高。显然,顺序表的存储密度为1,而链表的存储密度小于1。

4.2 时间性能的比较

(l)存取元素的效率 顺序表是由数组实现的,它是一种随机存取结构,指定任意一个位置序号都可以在0(1) 时间内直接存取该位置上的元素,即取值操作的效率高;而链表是一种顺序存取结构,按位置访问链表中元素时,只能从表头开始依次向后遍历链表,直到找到第i个位置上的元素,时间复杂度为O(n), 即取值操作的效率低。

(2)插入和删除操作的效率对比

链表在确定插入或删除的位置后,插入或删除操作无需移动数据,只需要修改指针, 时间复杂度为0(1)。顺序表进行插入或删除时,平均要移动表中近一半的结点,时间复杂度为O(n)。

相关文章:

数据结构严蔚敏版精简版-线性表以及c语言代码实现

线性表、栈、队列、串和数组都属于线性结构。线性结构的基本特点是除第一个元素无直接前驱&#xff0c;最后一个元素无直接后继之外&#xff0c;其他每个数据元素都有一个前驱和后继。 1 线性表的定义和特点 如此类由n&#xff08;n大于等于0&#xff09;个数据特性相同的元素…...

【react】react项目支持鼠标拖拽的边框改变元素宽度的组件

目录 安装使用方法示例Props 属性方法示例代码调整兄弟div的宽度 re-resizable github地址 安装 $ npm install --save re-resizable这将安装re-resizable库并将其保存为项目的依赖项。 使用方法 re-resizable 提供了一个 <Resizable> 组件&#xff0c;它可以包裹任何…...

QT 创建文件 Ui 不允许使用不完整类型,可以尝试添加一下任何头文件

#include "debug.h" #include "qmessagebox.h" #pragma execution_character_set("utf-8") //QT 创建文件 Ui 不允许使用不完整类型,尝试添加一下任何头文件&#xff0c;或者添加ui_xx.h头文件 debug::debug(QWidget *parent) : QDialog(p…...

Python:深入探索其生态系统与应用领域

Python&#xff1a;深入探索其生态系统与应用领域 Python&#xff0c;作为一种广泛应用的编程语言&#xff0c;其生态系统之丰富、应用领域之广泛&#xff0c;常常令人叹为观止。那么&#xff0c;Python究竟涉及哪些系统&#xff1f;本文将从四个方面、五个方面、六个方面和七…...

EXCEL从图片链接获取图片

step1: 选中图片地址列 step2:开发工具→Visual Basic 文件→导入 导入我制作的脚本&#xff08;代码见文章末尾&#xff09; 点击excel的小图标回到表格界面。 点击【宏】 选中刚才导入的脚本&#xff0c;点执行&#xff0c;等待完成。 代码本体&#xff1a; Sub InsertPict…...

Docker迁移默认存储目录(GPT-4o)

Docker在Ubuntu的默认存储目录是/var/lib/docker&#xff0c;要将 Docker 的默认存储目录迁移到指定目录&#xff08;譬如大存储磁盘&#xff09;&#xff0c;可以通过修改 Docker 守护进程的配置文件来实现。 1.创建新的存储目录&#xff1a; 选择你想要存储 Docker 分层存储…...

植物大战僵尸杂交版2.0.88最新版安装包

游戏简介 游戏中独特的杂交植物更是为游戏增添了不少亮点。这些杂交植物不仅外观独特&#xff0c;而且拥有更强大的能力&#xff0c;能够帮助玩家更好地应对游戏中的挑战。玩家可以通过一定的条件和方式&#xff0c;解锁并培养这些杂交植物&#xff0c;从而不断提升自己的战斗…...

MQ基础(RabbitMQ)

通信 同步通信&#xff1a;就相当于打电话&#xff0c;双方交互是实时的。同一时刻&#xff0c;只能与一人交互。 异步通信&#xff1a;就相当于发短信&#xff0c;双方交互不是实时的。不需要立刻回应对方&#xff0c;可以多线程操作&#xff0c;跟不同人同时聊天。 RabbitM…...

eclipse添加maven插件

打开eclipse菜单 Help/Install New SoftwareWork with下拉菜单选择 2022-03 - https://download.eclipse.org/releases/2022-03‘type filter text’搜索框中输入 maven选择 M2E - Maven Integration for Eclipse一路next安装&#xff0c;重启eclipseImport项目时&#xff0c;就…...

知识库系统:从认识到搭建

在这个信息过载的时代&#xff0c;企业越来越需要一个集中的知识库系统来促进员工协作和解决问题。本文跟着LookLook同学一起来探讨搭建高效知识库系统的所有注意事项和知识库系统的最佳推荐。 | 什么是知识库系统 知识库系统是一种软件或工具&#xff0c;旨在填补组织内的知识…...

JVM双亲委派模型

在之前的JVM类加载器篇中说过&#xff0c;各个类加载器都有自己加载的范围&#xff0c;比如引导类加载器只加载Java核心库中的class如String&#xff0c;那如果用户自己建一个包名和类名与String相同的类&#xff0c;会不会被引导类加载器加载。可以通过如下代码测试&#xff0…...

Python语言与算法:深度探索与实战应用

Python语言与算法&#xff1a;深度探索与实战应用 在数字化浪潮汹涌的时代&#xff0c;Python语言以其简洁、易读和强大的功能库成为了编程界的翘楚。而算法&#xff0c;作为计算机科学的核心&#xff0c;是解决问题、优化性能的关键。本文将围绕Python语言与算法的结合&#…...

Python实现连连看7

3.3 根据地图显示图片 在获取了图片地图之后,就可以根据该图片地图显示图片了。显示图片的功能在自定义函数drawMap()中实现。 3.3.1 清除画布中的内容 在画布上显示图片之前,需要将画布中图1的启动界面内容清除,代码如下所示。 canvas.delete(all) 其中,delete()方法…...

C#中的as和is

在 C# 中&#xff0c;as 和 is 是用于类型转换和类型检查的操作符。 as 操作符&#xff1a; as 操作符用于尝试将一个对象转换为指定的引用类型或可空类型&#xff0c;如果转换失败&#xff0c;将返回 null。语法&#xff1a;expression as type示例&#xff1a; object obj &…...

示波器眼图怎么看

目录 什么是眼图&#xff1f; 怎么看&#xff1f; 眼图的电压幅度&#xff08;Y轴&#xff09; 眼睛幅度和高度 信噪比 抖动 上升时间和下降时间 眼宽 什么是眼图&#xff1f; 眼图&#xff08;Eye Diagram&#xff09;是一种用于分析高速数字信号传输质量的重要工具。通…...

Visual Studio Code编辑STM32CubeMX已生成的文件

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

【读脑仪game】

读脑仪&#xff08;Brain-Computer Interface&#xff0c;BCI&#xff09;游戏是一种利用脑电信号来控制游戏的新型交互方式。这类游戏通常需要专业的硬件设备来读取用户的脑电信号&#xff0c;并将这些信号转化为游戏中的控制信号。编写这样的游戏代码涉及到多个方面&#xff…...

基于STM32的毕业设计示例

**基于STM32的毕业设计示例** 一、引言 在当前的电子工程领域&#xff0c;STM32微控制器因其高性能、低功耗和丰富的外设接口而备受青睐。本次毕业设计旨在展示基于STM32微控制器的系统设计与实现能力&#xff0c;通过构建一个具有实际应用价值的系统&#xff0c;体现对嵌入式…...

图片格式怎么转成pdf,简单的方法

在现代数字化时代&#xff0c;图片格式转换成PDF已经成为许多人的日常需求。无论是为了存档、分享还是打印&#xff0c;将图片转换为PDF都是一项非常实用的技能。本文将详细介绍如何将图片格式转换成PDF的方法。 用浏览器打开 "轻云处理pdf官网&#xff0c;上传图片。 图…...

在 Debian 上使用和配置 SSH 的指南

SSH&#xff08;Secure Shell&#xff09;是用于在不安全网络上安全登录远程计算机和执行命令的协议。本文将详细介绍如何在 Debian 系统上安装、配置和使用 SSH。 1. 安装 SSH 首先&#xff0c;您需要安装 OpenSSH 服务器和客户端&#xff08;也可直接安装服务器端&#xff…...

java 实现excel文件转pdf | 无水印 | 无限制

文章目录 目录 文章目录 前言 1.项目远程仓库配置 2.pom文件引入相关依赖 3.代码破解 二、Excel转PDF 1.代码实现 2.Aspose.License.xml 授权文件 总结 前言 java处理excel转pdf一直没找到什么好用的免费jar包工具,自己手写的难度,恐怕高级程序员花费一年的事件,也…...

【android bluetooth 框架分析 04】【bt-framework 层详解 1】【BluetoothProperties介绍】

1. BluetoothProperties介绍 libsysprop/srcs/android/sysprop/BluetoothProperties.sysprop BluetoothProperties.sysprop 是 Android AOSP 中的一种 系统属性定义文件&#xff08;System Property Definition File&#xff09;&#xff0c;用于声明和管理 Bluetooth 模块相…...

Axios请求超时重发机制

Axios 超时重新请求实现方案 在 Axios 中实现超时重新请求可以通过以下几种方式&#xff1a; 1. 使用拦截器实现自动重试 import axios from axios;// 创建axios实例 const instance axios.create();// 设置超时时间 instance.defaults.timeout 5000;// 最大重试次数 cons…...

【python异步多线程】异步多线程爬虫代码示例

claude生成的python多线程、异步代码示例&#xff0c;模拟20个网页的爬取&#xff0c;每个网页假设要0.5-2秒完成。 代码 Python多线程爬虫教程 核心概念 多线程&#xff1a;允许程序同时执行多个任务&#xff0c;提高IO密集型任务&#xff08;如网络请求&#xff09;的效率…...

3-11单元格区域边界定位(End属性)学习笔记

返回一个Range 对象&#xff0c;只读。该对象代表包含源区域的区域上端下端左端右端的最后一个单元格。等同于按键 End 向上键(End(xlUp))、End向下键(End(xlDown))、End向左键(End(xlToLeft)End向右键(End(xlToRight)) 注意&#xff1a;它移动的位置必须是相连的有内容的单元格…...

JVM虚拟机:内存结构、垃圾回收、性能优化

1、JVM虚拟机的简介 Java 虚拟机(Java Virtual Machine 简称:JVM)是运行所有 Java 程序的抽象计算机,是 Java 语言的运行环境,实现了 Java 程序的跨平台特性。JVM 屏蔽了与具体操作系统平台相关的信息,使得 Java 程序只需生成在 JVM 上运行的目标代码(字节码),就可以…...

【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的“no matching...“系列算法协商失败问题

【SSH疑难排查】轻松解决新版OpenSSH连接旧服务器的"no matching..."系列算法协商失败问题 摘要&#xff1a; 近期&#xff0c;在使用较新版本的OpenSSH客户端连接老旧SSH服务器时&#xff0c;会遇到 "no matching key exchange method found"​, "n…...

Java数值运算常见陷阱与规避方法

整数除法中的舍入问题 问题现象 当开发者预期进行浮点除法却误用整数除法时,会出现小数部分被截断的情况。典型错误模式如下: void process(int value) {double half = value / 2; // 整数除法导致截断// 使用half变量 }此时...

【Android】Android 开发 ADB 常用指令

查看当前连接的设备 adb devices 连接设备 adb connect 设备IP 断开已连接的设备 adb disconnect 设备IP 安装应用 adb install 安装包的路径 卸载应用 adb uninstall 应用包名 查看已安装的应用包名 adb shell pm list packages 查看已安装的第三方应用包名 adb shell pm list…...

Vite中定义@软链接

在webpack中可以直接通过符号表示src路径&#xff0c;但是vite中默认不可以。 如何实现&#xff1a; vite中提供了resolve.alias&#xff1a;通过别名在指向一个具体的路径 在vite.config.js中 import { join } from pathexport default defineConfig({plugins: [vue()],//…...