深入手撕链表

news2024/9/17 9:09:56

链表

  • 分类
  • 概念
  • 单链表
      • 尾插
      • 头插
      • 插入
      • 尾删
      • 头删
      • 删除
    • 完整实现
      • 带头
      • 不带头
  • 双向链表
    • 初始化
      • 尾插
      • 头插
      • 插入
    • 完整代码
  • 数组

分类

链表
单链表
双向链表
种类
循环与非循环
带头与不带头
STL
list

概念

链表是一种物理存储结构上非连续非顺序的存储结构,数据元素的逻辑顺序是通过链表中的指针链接次序实现的 。
在这里插入图片描述
单向与双向
在这里插入图片描述
带头与不带头
在这里插入图片描述
循环与不循环
在这里插入图片描述

单链表

尾插

带头

void SLPushBack(SLNode* head, SLNDataType x) {

	SLNode* newnode = CreateNode(x);

	SLNode* tail = head;
	while (tail->next != NULL) {
		tail = tail->next;
	}
	tail->next = newnode;
	
}

不带头

void SLPushBack(SLNode** head, SLNDataType x) {

	assert(head);//头节点的地址不可能为空

	SLNode* newnode = CreateNode(x);

	if (*head == NULL) {//没有节点
		*head = newnode;
	}
	else {
		//找尾
		SLNode* tail = *head;
		while (tail->next != NULL) {
			tail = tail->next;
		}
		tail->next = newnode;
	}

}

头插

带头

void SLPushPront(SLNode* head, SLNDataType x) {

	SLNode* newnode = CreateNode(x);

	newnode->next = head->next;
	head->next = newnode;
}

不带头

void SLPushPront(SLNode** head, SLNDataType x) {
	
	assert(head);

	SLNode* newnode = CreateNode(x);

	newnode->next = *head;
	*head = newnode;
}

插入

带头

void SLInsert(SLNode* head, SLNode* pos, SLNDataType x) {

	assert(head);
	assert(pos);

	SLNode* prev = head;
	while (prev->next != pos) {
		prev = prev->next;
	}

	SLNode* newnode = CreateNode(x);
	newnode->next = pos;
	prev->next = newnode;
}

不带头

void SLInsert(SLNode** head, SLNode* pos, SLNDataType x) {

	assert(head);
	assert(pos);
	assert(*head);

	if (*head == pos) {
		//头插
		SLPushPront(head, x);
	}else{
		SListNode* prev = *head;
		while (prev->next != pos) {
			prev = prev->next;
		}

		SListNode* newnode = CreateNode(x);
		newnode->next =pos;
		prev->next = newnode;
	}

}

尾删

带头

void SLPopBack(SLNode* head) {

	assert(head);
	assert(head->next);

	SLNode* prev = head;
	while (prev->next->next != NULL) {
		prev = prev->next;
	}

	free(prev->next);
	prev->next = NULL;
}

不带头

void SLPopBack(SLNode** head) {

	assert(head);
	assert(*head);

	if ((*head)->next == NULL) {
		free(*head);
		*head = NULL;
	}
	else {
		SLNode* prev = *head;
		while (prev->next->next != NULL) {
			prev = prev->next;
		}
		free(prev->next);
		prev->next = NULL;
	}
}

头删

带头

void SLPopFront(SLNode* head) {

	assert(head);
	assert(head->next);

	SLNode* tmp = head->next;
	head->next = head->next->next;

	free(tmp);
}

不带头

void SLPopFront(SLNode** head) {

	assert(head);
	assert(*head);

	SLNode* tmp = *head;
	*head = (*head)->next;

	free(tmp);
}

删除

带头

void SLErase(SLNode* head, SLNode* pos) {

	assert(head);
	assert(head->next);
	assert(pos);

	SLNode* prev = head;
	while (prev->next != pos) {
		prev = prev->next;
	}

	prev->next = pos->next;

	free(pos);
	pos = NULL;
}

不带头

void SLErase(SLNode** head, SLNode* pos) {

	assert(head);
	assert(pos);

	if (*head == pos) {
		SLPopFront(head);
	}
	else {
		SLNode* prev = *head;
		while (prev->next != pos) {
			prev = prev->next;
		}
		prev->next = pos->next;
		free(pos);
		pos = NULL;
	}
}

带头

SLNode* SLFind(SLNode* head, SLNDataType x) {

	SLNode* cur = head->next;
	while (cur) {
		if (cur->val == x) {
			return cur;
		}
		cur = cur->next;
	}

	return NULL;
}

不带头

SLNode* CreateNode(SLNDataType x) {

	SLNode* newnode = (SLNode*)malloc(sizeof(SLNode));
	if (newnode == NULL) {
		perror("malloc fail");
		exit(-1);
	}

	newnode->val = x;
	newnode->next = NULL;
	return newnode;
}

完整实现

带头

#pragma once
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>

typedef int SLNDataType;

typedef struct SListNode {
	SLNDataType val;
	struct SListNode* next;
}SLNode;

void SLPrint(SLNode* head);

void SLPushBack(SLNode* head, SLNDataType x);
void SLPushPront(SLNode* head, SLNDataType x);

SLNode* SLFind(SLNode* head, SLNDataType x);

void SLInsert(SLNode* head, SLNode* pos, SLNDataType x);

void SLPopBack(SLNode* head);
void SLPopFront(SLNode* head);
void SLErase(SLNode* head, SLNode* pos);

void SLDestroy(SLNode* head);
#include"SList.h"

void SLPrint(SLNode* head) {
	while (head) {
		printf("%d -> ", head->val);
		head = head->next;
	}
	printf("NULL\n");
}

SLNode* CreateNode(SLNDataType x) {

	SLNode* newnode = (SLNode*)malloc(sizeof(SLNode));
	if (newnode == NULL) {
		perror("malloc fail");
		exit(-1);
	}

	newnode->val = x;
	newnode->next = NULL;
	return newnode;
}

void SLPushBack(SLNode* head, SLNDataType x) {

	SLNode* newnode = CreateNode(x);

	SLNode* tail = head;
	while (tail->next != NULL) {
		tail = tail->next;
	}
	tail->next = newnode;
	
}

void SLPushPront(SLNode* head, SLNDataType x) {

	SLNode* newnode = CreateNode(x);

	newnode->next = head->next;
	head->next = newnode;
}

SLNode* SLFind(SLNode* head, SLNDataType x) {

	SLNode* cur = head->next;
	while (cur) {
		if (cur->val == x) {
			return cur;
		}
		cur = cur->next;
	}

	return NULL;
}

void SLInsert(SLNode* head, SLNode* pos, SLNDataType x) {

	assert(head);
	assert(pos);

	SLNode* prev = head;
	while (prev->next != pos) {
		prev = prev->next;
	}

	SLNode* newnode = CreateNode(x);
	newnode->next = pos;
	prev->next = newnode;
}

void SLPopBack(SLNode* head) {

	assert(head);
	assert(head->next);

	SLNode* prev = head;
	while (prev->next->next != NULL) {
		prev = prev->next;
	}

	free(prev->next);
	prev->next = NULL;
}

void SLPopFront(SLNode* head) {

	assert(head);
	assert(head->next);

	SLNode* tmp = head->next;
	head->next = head->next->next;

	free(tmp);
	tmp = NULL;
}

void SLErase(SLNode* head, SLNode* pos) {

	assert(head);
	assert(head->next);
	assert(pos);

	SLNode* prev = head;
	while (prev->next != pos) {
		prev = prev->next;
	}

	prev->next = pos->next;

	free(pos);
	pos = NULL;
}

void SLDestroy(SLNode* head) {
	
	assert(head);

	SLNode* cur = head->next;
	while(cur){
		SLNode* tmp = cur->next;
		free(cur);
		cur = tmp;
	}

	head->next = NULL;
}
#include"SList.h"

void test1() {
	SListNode* plist = (SListNode*)malloc(sizeof(SListNode));
	plist->val = 0;
	plist->next = NULL;

	SLPushBack(plist, 1);
	SLPushBack(plist, 3);
	SLPushBack(plist, 1);
	SLPushBack(plist, 4);

	SLPrint(plist -> next);

	SLPushPront(plist, 0);
	SLPushPront(plist, 2);
	SLPushPront(plist, 5);

	SLPrint(plist->next);
}

void test2() {
	SListNode* plist = (SListNode*)malloc(sizeof(SListNode));
	plist->val = 0;
	plist->next = NULL;

	SLPushBack(plist, 1);
	SLPushBack(plist, 3);
	SLPushBack(plist, 1);
	SLPushBack(plist, 4);

	SLPrint(plist->next);

	SLPushPront(plist, 0);
	SLPushPront(plist, 2);
	SLPushPront(plist, 5);

	SLPrint(plist->next);

	SLInsert(plist, SLFind(plist->next, 5), 520);

	SLPrint(plist->next);
}

void test3() {
	SListNode* plist = (SListNode*)malloc(sizeof(SListNode));
	plist->val = 0;
	plist->next = NULL;

	SLPushBack(plist, 1);

	SLPopBack(plist);

	SLPrint(plist->next);
}

void test4() {
	SListNode* plist = (SListNode*)malloc(sizeof(SListNode));
	plist->val = 0;
	plist->next = NULL;

	SLPushBack(plist, 1);
	SLPushBack(plist, 3);
	SLPushBack(plist, 1);
	SLPushBack(plist, 4);

	SLPrint(plist->next);

	SLPushPront(plist, 0);
	SLPushPront(plist, 2);
	SLPushPront(plist, 5);

	SLPrint(plist->next);

	SLPopFront(plist);
	SLPopFront(plist);
	SLPopFront(plist);

	SLPrint(plist->next);
}

void test5() {
	SListNode* plist = (SListNode*)malloc(sizeof(SListNode));
	plist->val = 0;
	plist->next = NULL;

	SLPushBack(plist, 1);
	SLPushBack(plist, 3);
	SLPushBack(plist, 1);
	SLPushBack(plist, 4);

	SLPrint(plist->next);

	SLPushPront(plist, 0);
	SLPushPront(plist, 2);
	SLPushPront(plist, 5);

	SLPrint(plist->next);

	SLErase(plist, SLFind(plist, 0));

	SLPrint(plist->next);
}


int main() {
	
	test5();

	return 0;
}

不带头

#pragma once
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>

typedef int SLNDataType;

typedef struct SListNode {
	SLNDataType val;
	struct SListNode* next;
}SLNode;

void SLPrint(SLNode* head);

void SLPushBack(SLNode** head, SLNDataType x);//尾插
void SLPushPront(SLNode** head, SLNDataType x);//头插
void SLInsert(SLNode** head, SLNode* pos, SLNDataType x); //插入

SLNode* SLFind(SLNode* head,SLNDataType x);//查找

void SLPopBack(SLNode** head);//尾删
void SLPopFront(SLNode** head);//头删
void SLErase(SLNode** head, SLNode* pos);//删除

void SLInsertAfter(SLNode* pos, SLNDataType x);//往后插
void SLEraseAfter(SLNode* pos);//往后删

void SLDestroy(SLNode** head);//清除
#include"SList.h"

void SLPrint(SLNode* head) {
	while (head) {
		printf("%d -> ", head->val);
		head = head->next;
	}
	printf("NULL\n");
}

SLNode* CreateNode(SLNDataType x) {

	SLNode* newnode = (SLNode*)malloc(sizeof(SLNode));
	if (newnode == NULL) {
		perror("malloc fail");
		exit(-1);
	}

	newnode->val = x;
	newnode->next = NULL;
	return newnode;
}

void SLPushBack(SLNode** head, SLNDataType x) {

	assert(head);//头节点的地址不可能为空

	SLNode* newnode = CreateNode(x);

	if (*head == NULL) {//没有节点
		*head = newnode;
	}
	else {
		//找尾
		SLNode* tail = *head;
		while (tail->next != NULL) {
			tail = tail->next;
		}
		tail->next = newnode;
	}

}

void SLPushPront(SLNode** head, SLNDataType x) {
	
	assert(head);

	SLNode* newnode = CreateNode(x);

	newnode->next = *head;
	*head = newnode;
}

SLNode* SLFind(SLNode* head, SLNDataType x) {

	while (head) {
		if (head->val == x) {
			return head;
		}
		head = head->next;
	}

	return NULL;
}

void SLInsert(SLNode** head, SLNode* pos, SLNDataType x) {

	assert(head);
	assert(pos);
	assert(*head);

	if (*head == pos) {
		//头插
		SLPushPront(head, x);
	}else{
		SListNode* prev = *head;
		while (prev->next != pos) {
			prev = prev->next;
		}

		SListNode* newnode = CreateNode(x);
		newnode->next =pos;
		prev->next = newnode;
	}

}

void SLPopBack(SLNode** head) {

	assert(head);
	assert(*head);

	if ((*head)->next == NULL) {
		free(*head);
		*head = NULL;
	}
	else {
		SLNode* prev = *head;
		while (prev->next->next != NULL) {
			prev = prev->next;
		}
		free(prev->next);
		prev->next = NULL;
	}
}

void SLPopFront(SLNode** head) {

	assert(head);
	assert(*head);

	SLNode* tmp = *head;
	*head = (*head)->next;

	free(tmp);
}

void SLErase(SLNode** head, SLNode* pos) {

	assert(head);
	assert(pos);

	if (*head == pos) {
		SLPopFront(head);
	}
	else {
		SLNode* prev = *head;
		while (prev->next != pos) {
			prev = prev->next;
		}
		prev->next = pos->next;
		free(pos);
		pos = NULL;
	}
}

void SLInsertAfter(SLNode* pos, SLNDataType x) {

	assert(pos);

	SLNode* newnode = CreateNode(x);
	
	newnode->next = pos->next;
	pos->next = newnode;
}

void SLEraseAfter(SLNode* pos) {

	assert(pos);
	assert(pos->next);

	SLNode* cur = pos->next;
	pos->next = cur->next;

	free(cur);
	cur = NULL;
}

void SLDestroy(SLNode** head) {
	
	assert(head);

	SLNode* cur = *head;
	while (cur) {
		SLNode* next = cur->next;
		free(cur);
		cur = next;
	}

	*head = NULL;
}
#include"SList.h"

void test1() {
	SListNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 1);
	SLPushBack(&plist, 4);

	SLPrint(plist);

	SLPushPront(&plist, 0);
	SLPushPront(&plist, 2);
	SLPushPront(&plist, 5);

	SLPrint(plist);
}

void test2() {
	SListNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 1);
	SLPushBack(&plist, 4);

	SLPrint(plist);

	SLPushPront(&plist, 0);
	SLPushPront(&plist, 2);
	SLPushPront(&plist, 5);

	SLPrint(plist);

	SLInsert(&plist, SLFind(plist, 2), 10);

	SLPrint(plist);
}

void test3() {
	SListNode* plist = NULL;

	SLPushBack(&plist, 1);
	
	SLPopBack(&plist);

	SLPrint(plist);
}

void test4() {
	SListNode* plist = NULL;

	SLPushBack(&plist, 1);
	SLPushBack(&plist, 3);
	SLPushBack(&plist, 1);
	SLPushBack(&plist, 4);

	SLPrint(plist);

	SLPushPront(&plist, 0);
	SLPushPront(&plist, 2);
	SLPushPront(&plist, 5);

	SLPrint(plist);

	SLErase(&plist, SLFind(plist, 0));

	SLPrint(plist);
}

int main() {

	test4();

	return 0;
}

双向链表

在这里插入图片描述

初始化

DLNode* DLInit() {

	DLNode* head = CreatDLNode(-1);
	head->next = head;
	head->prev = head;

	return head;
}

尾插

void DLPushBack(DLNode* head, DLTDataType x) {
	
	assert(head);

	DLNode* tail = head->prev;
	DLNode* newnode = CreatDLNode(x);

	tail->next = newnode;
	newnode->prev = tail;
	newnode->next = head;
	head->prev = newnode;
}

头插

void DLPushPront(DLNode* head, DLTDataType x) {

	assert(head);

	DLNode* tail = head->next;
	DLNode* newnode = CreatDLNode(x);

	head->next = newnode;
	newnode->prev = head;
	newnode->next = tail;
	tail->prev = newnode;
}

插入

void DLInsert(DLNode* pos, DLTDataType x) {

	assert(pos);

	DLNode* tail = pos->prev;
	DLNode* newnode = CreatDLNode(x);

	tail->next = newnode;
	newnode->prev = tail;
	newnode->next = pos;
	pos->prev = newnode;
}

void DLErase(DLNode* pos) {

	assert(pos);
	assert(pos != head);

	DLNode* tail = pos->prev;
	
	tail->next = pos->next;
	pos->next->prev = tail;

	free(pos);
}

DLNode* DLFind(DLNode* head, DLTDataType x) {

	assert(head);

	DLNode* cur = head->next;
	while (cur != head) {
		if (cur->val == x) {
			return cur;
		}
		cur = cur->next;
	}

	return NULL;
}

完整代码

#pragma once
#include<stdio.h>
#include<stdlib.h>
#include<assert.h>

typedef int DLTDataType;

typedef struct DList{
	struct DList* next;
	struct DList* prev;
	DLTDataType val;
}DLNode;

DLNode* DLInit();

void DLPrint(DLNode* head);

void DLPushBack(DLNode* head, DLTDataType x);
void DLPushPront(DLNode* head, DLTDataType x);
void DLInsert(DLNode* pos, DLTDataType x);

DLNode* DLFind(DLNode* head, DLTDataType x);

void DLPopBack(DLNode* head);
void DLPopFront(DLNode* head);
void DLErase(DLNode* pos);

void DLDestroy(DLNode* head);
#include"DList.h"

DLNode* CreatDLNode(DLTDataType x) {

	DLNode* newnode = (DLNode*)malloc(sizeof(DLNode));
	if (newnode == NULL) {
		perror("malloc fail");
		exit(-1);
	}

	newnode->val = x;
	newnode->next = NULL;
	newnode->prev = NULL;

	return newnode;
}

DLNode* DLInit() {

	DLNode* head = CreatDLNode(-1);
	head->next = head;
	head->prev = head;

	return head;
}

void DLPrint(DLNode* head) {

	assert(head);
	printf("head <=> ");

	DLNode* cur = head->next;
	while (cur != head) {
		printf("%d <=> ", cur->val);
		cur = cur->next;
	}
	printf("\n");
}

void DLPushBack(DLNode* head, DLTDataType x) {
	
	assert(head);

	DLNode* tail = head->prev;
	DLNode* newnode = CreatDLNode(x);

	tail->next = newnode;
	newnode->prev = tail;
	newnode->next = head;
	head->prev = newnode;
}

void DLPushPront(DLNode* head, DLTDataType x) {

	assert(head);

	DLNode* tail = head->next;
	DLNode* newnode = CreatDLNode(x);

	head->next = newnode;
	newnode->prev = head;
	newnode->next = tail;
	tail->prev = newnode;
}

DLNode* DLFind(DLNode* head, DLTDataType x) {

	assert(head);

	DLNode* cur = head->next;
	while (cur != head) {
		if (cur->val == x) {
			return cur;
		}
		cur = cur->next;
	}

	return NULL;
}

void DLInsert(DLNode* pos, DLTDataType x) {

	assert(pos);

	DLNode* tail = pos->prev;
	DLNode* newnode = CreatDLNode(x);

	tail->next = newnode;
	newnode->prev = tail;
	newnode->next = pos;
	pos->prev = newnode;
}

void DLPopBack(DLNode* head) {
	
	assert(head);

	assert(head->next != head);

	DLErase(head->prev);
}

void DLPopFront(DLNode* head) {

	assert(head);

	assert(head->next != head);

	DLErase(head->next);
}

void DLErase(DLNode* pos) {

	assert(pos);

	DLNode* tail = pos->prev;
	
	tail->next = pos->next;
	pos->next->prev = tail;

	free(pos);
}

void DLDestroy(DLNode* head) {

	assert(head);

	DLNode* cur = head->next;
	while (cur != head) {
		DLNode* tail = cur->next;
		free(cur);
		cur = tail;
	}

	free(head);
}
#include"DList.h"

void test1() {
	DLNode* head = DLInit();

	DLPushBack(head, 1);
	DLPushBack(head, 3);
	DLPushBack(head, 1);
	DLPushBack(head, 4);

	DLPushPront(head, 0);
	DLPushPront(head, 2);
	DLPushPront(head, 5);

	DLPrint(head);
}

void test2() {
	DLNode* head = DLInit();

	DLPushBack(head, 1);
	DLPushBack(head, 3);
	DLPushBack(head, 1);
	DLPushBack(head, 4);

	DLPushPront(head, 0);
	DLPushPront(head, 2);
	DLPushPront(head, 5);

	DLPrint(head);
    
	DLInsert(DLFind(head, 2), 3);

	DLPrint(head);
}

void test3() {
	DLNode* head = DLInit();

	DLPushBack(head, 1);
	DLPushBack(head, 3);
	DLPushBack(head, 1);
	DLPushBack(head, 4);

	DLPushPront(head, 0);
	DLPushPront(head, 2);
	DLPushPront(head, 5);

	DLPrint(head);

	DLInsert(DLFind(head, 2), 3);

	DLPrint(head);

	DLErase(DLFind(head, 3));

	DLPopBack(head);
	DLPopFront(head);

	DLPrint(head);
}

int main() {

	test3();

	return 0;
}

数组

接下来我们用数组简单实现一下链表,可以用于一些oj题。


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

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

相关文章

Java 入门指南:JVM(Java虚拟机)—— Java 内存运行时的数据区域

前言 对于 Java 程序员来说&#xff0c;在虚拟机自动内存管理机制下&#xff0c;不再需要像 C/C程序开发程序员这样为每一个 new 操作去写对应的 delete/free 操作&#xff0c;不容易出现内存泄漏和内存溢出问题。 由于程序员把内存控制权利交给 Java 虚拟机&#xff0c;一旦…

【CSS in Depth 2 精译_025】4.3 弹性布局的方向

当前内容所在位置&#xff08;可进入专栏查看其他译好的章节内容&#xff09; 第一章 层叠、优先级与继承&#xff08;已完结&#xff09; 1.1 层叠1.2 继承1.3 特殊值1.4 简写属性1.5 CSS 渐进式增强技术1.6 本章小结 第二章 相对单位&#xff08;已完结&#xff09; 2.1 相对…

NISP 一级 | 2.3 身份认证

关注这个证书的其他相关笔记&#xff1a;NISP 一级 —— 考证笔记合集-CSDN博客 0x01&#xff1a;身份认证基本方法 身份认证是用户登录系统或网站面对的第一道安全防线&#xff0c;如输入账号口令来登录。身份认证是在网络中确认操作者身份的过程。身份认证一般依据以下三种情…

Thread如何划分为Warp?

1 .Thread如何划分为Warp? https://jielahou.com/code/cuda/thread-to-warp.html Thread Index和Thread ID之间有什么关系呢&#xff1f;&#xff08;线程架构参考这里&#xff1a;CUDA C Programming Guide (nvidia.com)open in new window&#xff09; 1维的Thread Index&am…

ORCAD出BOM--位号在同一个Excel格子里

所有相同属性的器件都在同一个格子里 Tools\ Bill of Materials, 注意勾选Open in excel. 勾选Open in excel, 所有相同属性的器件都在同一个格子里 不勾选Open in excel, 5个相同属性的器件都在同一个格子里

代码随想录Day 39|打家劫舍问题,leetcode题目:198.打家劫舍、213.打家劫舍Ⅱ、337.打家劫舍Ⅲ

提示&#xff1a;DDU&#xff0c;供自己复习使用。欢迎大家前来讨论~ 文章目录 题目题目一&#xff1a;198.打家劫舍解题思路&#xff1a; 题目二&#xff1a;213.打家劫舍II解题思路&#xff1a; 题目三&#xff1a; 337.打家劫舍 III解题思路暴力递归记忆化递推动态规划 总结…

Linux基础2-权限2(操作权限,粘滞位,umask,目录文件的rwx权限)

上篇内容&#xff1a;Linux基础2-权限1(用户&#xff0c;权限是什么&#xff1f;)-CSDN博客 目录 一. 权限的操作&#xff08;命令&#xff09; 1.1 chmod 1.2 chown 1.3 chgrp 二. 粘滞位 三. umask&#xff08;遮掩码&#xff09; 四. 目录文件的 r w x 权限 一. 权限…

数据库的操作:SQL语言的介绍

一.前言 SQL是一种结构化查询语言。关系型数据库中进行操作的标准语言。 二.特点 ①对大小写不敏感 例如&#xff1a;select与Select是一样的 ②结尾要使用分号 没有分号认为还没结束; 三.分类 ①DDL&#xff1a;数据定义语言&#xff08;数据库对象的操作&#xff08;结…

服务器重装系统,数据备份 容器备份

文章目录 1.前言2.docker备份2.1 容器备份2.2 镜像备份2.3 数据卷备份 3.docker安装4.jdk安装5.导入镜像6.导入容器 本文档只是为了留档方便以后工作运维&#xff0c;或者给同事分享文档内容比较简陋命令也不是特别全&#xff0c;不适合小白观看&#xff0c;如有不懂可以私信&a…

【最新华为OD机试E卷-支持在线评测】计算疫情扩散时间(200分)多语言题解-(Python/C/JavaScript/Java/Cpp)

🍭 大家好这里是春秋招笔试突围 ,一枚热爱算法的程序员 ✨ 本系列打算持续跟新华为OD-E/D卷的三语言AC题解 💻 ACM金牌🏅️团队| 多次AK大厂笔试 | 编程一对一辅导 👏 感谢大家的订阅➕ 和 喜欢💗 🍿 最新华为OD机试D卷目录,全、新、准,题目覆盖率达 95% 以上,…

DDComponentForAndroid:探索Android组件化方案

在现代Android应用开发中&#xff0c;随着应用规模的不断扩大&#xff0c;传统的单体应用架构已经无法满足快速迭代和维护的需求。组件化架构作为一种解决方案&#xff0c;可以将应用拆分成多个独立的模块&#xff0c;每个模块负责特定的功能&#xff0c;从而提高代码的可维护性…

2.ChatGPT的发展历程:从GPT-1到GPT-4(2/10)

引言 在人工智能领域&#xff0c;自然语言处理&#xff08;NLP&#xff09;是连接人类与机器的重要桥梁。随着技术的不断进步&#xff0c;我们见证了从简单的文本分析到复杂的语言理解的转变。ChatGPT&#xff0c;作为自然语言处理领域的一个里程碑&#xff0c;其发展历程不仅…

【C/C++】C++程序设计基础(继承与派生、多态性)

目录 八、继承与派生8.1 派生类的引入与特性8.2 单继承8.3 同名成员的访问方式8.4 赋值兼容规则8.5 单继承的构造与析构8.6 多继承 九、多态性9.1 运算符重载9.2 虚函数9.3 纯虚函数与抽象类 八、继承与派生 8.1 派生类的引入与特性 -继承:一旦指定了某种事物父代的本质特征&a…

线程相关内容

线程 一、介绍二、thread库1、构造函数&#xff08;1&#xff09;函数&#xff08;2&#xff09;说明&#xff08;3&#xff09;注意 2、join函数3、detach4、joinable函数5、get_id函数 三、mutex的种类1、mutex&#xff08;1&#xff09;介绍&#xff08;2&#xff09;lock&a…

vant UI之van-tab如何实现标题两行显示

前言&#xff1a; 相必大家在开发移动端或者小程序时都会见到如下设计稿 这个时候大家基本上都会想到使用vant UI 的van-tab组件&#xff0c;如果实现不了那就自己封装一个tab组件这样的情况。 其实使用van-tab是可以实现的&#xff0c;不过要借助van-tab的一系列api和css&…

数据结构(2):LinkedList和链表[1]

下面我们来介绍一种新的数据结构&#xff0c;链表。 我们曾经讨论过顺序表。它的数据存储在物理和逻辑上都是有逻辑的。而我们今天要学习的链表&#xff0c;则在物理结构上非连续存储&#xff0c;逻辑上连续。 1.链表的认识 链表由一个一个的节点组成。 我们可以想象一列火…

乐鑫安全制造全流程

主要参考资料&#xff1a; 【乐鑫全球开发者大会】DevCon24 #10 &#xff5c;乐鑫安全制造全流程 乐鑫官方文档Flash加密: https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32/security/flash-encryption.html 【ESP32S3】使用 Flash 下载工具完成 Flash 加密功能…

C++ | Leetcode C++题解之第394题字符串解码

题目&#xff1a; 题解&#xff1a; class Solution { public:string src; size_t ptr;int getDigits() {int ret 0;while (ptr < src.size() && isdigit(src[ptr])) {ret ret * 10 src[ptr] - 0;}return ret;}string getString() {if (ptr src.size() || src[…

C语言 | Leetcode C语言题解之第393题UTF-8编码验证

题目&#xff1a; 题解&#xff1a; static const int MASK1 1 << 7; static const int MASK2 (1 << 7) (1 << 6);bool isValid(int num) {return (num & MASK2) MASK1; }int getBytes(int num) {if ((num & MASK1) 0) {return 1;}int n 0;in…

windows电脑自动倒计时关机

今天聊一聊其他的。我时不时的有一个需求&#xff0c;是关于在windows电脑上定时关机。 不知道怎么地&#xff0c;我好几次都忘了这个自动定时关机的终端命令&#xff0c;于是每一次都要去网上查。 1.鼠标右击【开始菜单】选择【运行】或在键盘上按【 WinR】快捷键打开运行窗口…