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

顺序表和链表的各种代码实现

一、线性表

在日常生活中,线性表的例子比比皆是。例如,26个英文字母的字母表(A,B,C,……,Z)是一个线性表,表中的数据元素式单个字母。在稍复杂的线性表中,一个数据元素可以包含若干个数据项。例如在第一章中提到的学生基本信息表,每个学生为一个数据元素,包括学号、姓名、性别、籍贯、专业等数据项。

由以上两例可以看出,它们的数据元素虽然不同,但同一线性表中的元素必定具有相同的特性,即属于同一数据对象,相邻数据元素之间存在这序偶关系。诸如此类由n个数据特性相同的元素构成的有限序列成为线性表。对于非空的线性表或线性结构,其特点是:

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

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

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

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

二、顺序表和链表

1、顺序表的定义:

顺序表是用一段 物理地址连续 的存储单元依次存储数据元素的线性结构,一般情况下采用数组存
储。在数组上完成数据的增删查改。
顺序表可以分为静态顺序表和动态顺序表:
静态顺序表:
静态顺序表:使用定长数组存储元素
存储结构
typedef struct SeqList
{SLDataType x;int size;
}SeqList
动态顺序表: 
动态顺序表:使用动态开辟的数组存储。
typedef struct SeqList
{SLDataType* Array;int size;     //顺序表当前的元素个数int capacity; //顺序表的最大容量
}

以下是实现顺序表的接口代码:

头文件:

#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>typedef int SLDateType;
typedef struct SeqList
{SLDateType* a;int size;int capacity;
}SeqList;// 对数据的管理:增删查改 
void SeqListInit(SeqList* ps);
void SeqListDestroy(SeqList* ps);void SeqListPrint(SeqList* ps);
void SeqListPushBack(SeqList* ps, SLDateType x);
void SeqListPushFront(SeqList* ps, SLDateType x);
void SeqListPopFront(SeqList* ps);
void SeqListPopBack(SeqList* ps);// 顺序表查找
int SeqListFind(SeqList* ps, SLDateType x);
// 顺序表在pos位置插入x
void SeqListInsert(SeqList* ps, int pos, SLDateType x);
// 顺序表删除pos位置的值
void SeqListErase(SeqList* ps, int pos);
//修改顺序表pos位置的值
void SeqListModify(SeqList* ps, int pos, SLDateType x);

函数实现文件:

#define _CRT_SECURE_NO_WARNINGS 1
#include "SList.h"void SeqListInit(SeqList* ps)
{assert(ps);ps->a = (SLDateType*)malloc(sizeof(SLDateType)*4);ps->capacity = 4;ps->size = 0;
}
void SeqListDestroy(SeqList* ps)
{assert(ps);free(ps->a);ps->size = 0;ps->capacity = 0;
}void SeqListPrint(SeqList* ps)
{assert(ps);int i = 0;for (i = 0; i < ps->size; i++){printf("%d ", ps->a[i]);}printf("\n");
}
//检查增容的函数
void CheckCapacity(SeqList* ps)
{if (ps->capacity == ps->size){SLDateType* temp = (SLDateType*)realloc(ps->a, (ps->capacity * 2) * sizeof(SLDateType));if (temp == NULL){perror("mallco fail");return;}else{ps->a = temp;ps->capacity = ps->capacity * 2;}}
}
void SeqListPushBack(SeqList* ps, SLDateType x)
{//尾插首先检查增容CheckCapacity(ps);//增容完毕后开始插入数据ps->a[ps->size++] = x;
}
void SeqListPushFront(SeqList* ps, SLDateType x)
{//头插首先检查增容CheckCapacity(ps);//开始头插//往后面移动数据,从后往前移int end = 0;for (end = ps->size; end > 0; end--){ps->a[end] = ps->a[end - 1];}ps->a[end] = x;ps->size++;
}
void SeqListPopFront(SeqList* ps)
{assert(ps);assert(ps->size > 0);//头删int end = 0;for (end = 0; end < ps->size-1; end++){ps->a[end] = ps->a[end + 1];}ps->size--;
}
void SeqListPopBack(SeqList* ps)
{assert(ps->size > 0);assert(ps);ps->size--;
}
// 顺序表查找
int SeqListFind(SeqList* ps, SLDateType x)
{assert(ps);int i = 0;while (i < ps->size){if (ps->a[i] == x){return i;}i++;}//下标不可能是-1return -1;
}
// 顺序表在pos位置插入x
void SeqListInsert(SeqList* ps, int pos, SLDateType x)
{assert(ps);assert(pos >= 0 && pos <= ps->size);//检查增容CheckCapacity(ps);int end = 0;for (end = ps->size; end > pos; end--){ps->a[end] = ps->a[end - 1];}ps->a[pos] = x;ps->size++;
}
// 顺序表删除pos位置的值
void SeqListErase(SeqList* ps, int pos)
{assert(ps);assert(pos >= 0 && pos < ps->size);int end = 0;for (end = pos; end < ps->size - 1; end++){ps->a[end] = ps->a[end + 1];}ps->size--;
}
//修改函数
void SeqListModify(SeqList* ps,int pos,SLDateType x)
{assert(ps);assert(pos >= 0 && pos < ps->size);ps->a[pos] = x;
}

测试文件:

define _CRT_SECURE_NO_WARNINGS 1
#include "SList.h"void test1()
{SeqList s;SeqListInit(&s);SeqListPushBack(&s, 1);SeqListPushBack(&s, 2);SeqListPushBack(&s, 3);SeqListPushBack(&s, 4);SeqListPushBack(&s, 5);SeqListPrint(&s);SeqListPushFront(&s, 5);SeqListPushFront(&s, 4);SeqListPushFront(&s, 3);SeqListPrint(&s);SeqListPopFront(&s);SeqListPopFront(&s);SeqListPopFront(&s);SeqListPrint(&s);SeqListPopBack(&s);SeqListPopBack(&s);SeqListPopBack(&s);SeqListPopBack(&s);SeqListPopBack(&s);//SeqListPopBack(&s);SeqListPrint(&s);SeqListDestroy(&s);
}
void test2()
{SeqList s;SeqListInit(&s);SeqListPushBack(&s, 1);SeqListPushBack(&s, 2);SeqListPushBack(&s, 3);SeqListPushBack(&s, 4);SeqListPushBack(&s, 5);SeqListInsert(&s, 1, 2);SeqListPrint(&s);
}void test3()
{SeqList s;SeqListInit(&s);SeqListPushBack(&s, 1);SeqListPushBack(&s, 2);SeqListPushBack(&s, 3);SeqListPushBack(&s, 4);SeqListPushBack(&s, 5);/*SeqListInsert(&s, 1, 2);SeqListInsert(&s, 6, 6);SeqListInsert(&s, 0, 0);SeqListErase(&s, 0);SeqListErase(&s, 6);*/SeqListPrint(&s);int pos = SeqListFind(&s, 2);SeqListInsert(&s, pos, 3);SeqListPrint(&s);SeqListModify(&s, 1, 2);SeqListPrint(&s);
}
int main()
{//test1();//test2();test3();return 0;
}

2、单链表的定义:

概念:链表是一种 物理存储结构上非连续 、非顺序的存储结构,数据元素的 逻辑顺序 是通过链表 中的指针链接 次序实现的 。
链表实现代码:
头文件:
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef int SLTypeData;
typedef struct SList
{SLTypeData data;struct SList* next;
}SList;
//打印函数
void SListPrint(SList* phead);
//头插函数
void SListPushFront(SList** pphead,SLTypeData x);
//头删函数
void SListPopFront(SList** pphead);
//尾插函数
void SListPushBack(SList** pphead,SLTypeData x);
//尾删函数
void SListPopBack(SList** pphead);
//查找单链表
SList* SListFind(SList* plist, SLTypeData x);
// 单链表在pos位置之后插入x
// 分析思考为什么不在pos位置之前插入?
void SListInsertAfter(SList* pos, SLTypeData x);
//单链表的修改
void SListModify(SList* pos, SLTypeData x);
// 单链表删除pos位置之后的值
// 分析思考为什么不删除pos位置?
void SListEraseAfter(SList* pos);
// 单链表的销毁
void SListDestroy(SList* plist);

实现文件:
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
typedef int SLTypeData;
typedef struct SList
{SLTypeData data;struct SList* next;
}SList;
//打印函数
void SListPrint(SList* phead);
//头插函数
void SListPushFront(SList** pphead,SLTypeData x);
//头删函数
void SListPopFront(SList** pphead);
//尾插函数
void SListPushBack(SList** pphead,SLTypeData x);
//尾删函数
void SListPopBack(SList** pphead);
//查找单链表
SList* SListFind(SList* plist, SLTypeData x);
// 单链表在pos位置之后插入x
// 分析思考为什么不在pos位置之前插入?
void SListInsertAfter(SList* pos, SLTypeData x);
//单链表的修改
void SListModify(SList* pos, SLTypeData x);
// 单链表删除pos位置之后的值
// 分析思考为什么不删除pos位置?
void SListEraseAfter(SList* pos);
// 单链表的销毁
void SListDestroy(SList* plist);
测试文件:
#define _CRT_SECURE_NO_WARNINGS 1
#include "SList.h"
void test1()
{SList* plist = NULL;SListPushFront(&plist, 1);SListPushFront(&plist, 2);SListPushFront(&plist, 3);SListPushFront(&plist, 4);SListPushFront(&plist, 5);SListPrint(plist);SListPopFront(&plist);SListPopFront(&plist);SListPopFront(&plist);SListPopFront(&plist);SListPopFront(&plist);//SListPopFront(&plist);SListPrint(plist);
}
void test2()
{SList* plist = NULL;SListPushBack(&plist, 1);SListPushBack(&plist, 2);SListPushBack(&plist, 3);SListPushBack(&plist, 4);SListPushBack(&plist, 5);SListPrint(plist);SListPopBack(&plist);SListPopBack(&plist);SListPopBack(&plist);SListPopBack(&plist);SListPopBack(&plist);//SListPopBack(&plist);SListPrint(plist);
}void test3()
{SList* plist = NULL;SListPushBack(&plist, 1);SListPushBack(&plist, 2);SListPushBack(&plist, 3);SListPushBack(&plist, 4);SListPushBack(&plist, 5);SListPrint(plist);SList* pos = SListFind(plist,5);if (pos == NULL){printf("没有找到\n");}else{printf("%d\n", pos->data);}SListInsertAfter(pos, 6);SListPrint(plist);pos = SListFind(plist, 5);SListEraseAfter(pos);SListPrint(plist);SListModify(pos, 4);SListPrint(plist);SListDestroy(plist);
}
int main()
{//test1();//test2();test3();return 0;
}

双向带头循环链表的实现:

头文件:

#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stdbool.h>
typedef int STListType;
typedef struct STList
{STListType val;struct STList* prev;struct STList* next;
}STList;
//初始化链表的函数
STList* initSTList();
//新建节点的函数
STList* BuyNode(STListType x);
//头插函数
void STListPushFront(STList* phead, STListType x);
//头删函数
void STListPopFront(STList* phead);
//尾插函数
void STListPushBack(STList* phead, STListType x);
//尾删函数
void STListPopBack(STList* phead);
//判空函数
bool EmptySTList(STList* phead);
//打印函数
void PrintSTList(STList* phead);
//查找函数
STList* FindSTList(STList* phead, STListType x);
//在任意位置插入
void STListPosInsert(STList* phead, STListType x);
//在任意位置删除
void STListPosErase(STList* phead);
//销毁函数
void DesSTList(STList* phead);

函数的实现:

#define _CRT_SECURE_NO_WARNINGS 1
#include "STList.h"
//初始化链表的函数
STList* initSTList()
{STList* phead = malloc(sizeof(STList));phead->val = -1;phead->next = phead;phead->prev = phead;return phead;
}
//新建节点的函数
STList* BuyNode(STListType x)
{STList* newnode = (STList*)malloc(sizeof(STList));newnode->prev = NULL;newnode->next = NULL;newnode->val = x;return newnode;
}
//头插函数
void STListPushFront(STList* phead, STListType x)
{assert(phead);STList* newnode = BuyNode(x);newnode->next = phead->next;phead->next->prev = newnode;newnode->prev = phead;phead->next = newnode;
}
//头删函数
void STListPopFront(STList* phead)
{assert(phead);assert(!EmptySTList(phead));STList* cur = phead->next;STList* next = cur->next;phead->next = next;next->prev = phead;free(cur);cur = NULL;
}
//尾插函数
void STListPushBack(STList* phead, STListType x)
{assert(phead);STList* newnode = BuyNode(x);STList* tail = phead->prev;tail->next = newnode;newnode->prev = tail;newnode->next = phead;phead->prev = newnode;
}
//尾删函数
void STListPopBack(STList* phead)
{assert(phead);assert(!EmptySTList(phead));STList* tail = phead->prev;STList* prev = tail->prev;prev->next = phead;phead->prev = prev;
}
//判空函数
bool EmptySTList(STList* phead)
{assert(phead);return phead->next == phead;
}//打印函数
void PrintSTList(STList* phead)
{assert(phead);STList* cur = phead->next;printf("head<==>");while (cur != phead){printf("%d<==>", cur->val);cur = cur->next;}printf("NULL\n");
}//查找函数
STList* FindSTList(STList* phead, STListType x)
{assert(phead);STList* cur = phead->next;while (cur != phead){if (cur->val == x){return cur;}cur = cur->next;}return NULL;
}//在任意位置前插入
void STListPosInsert(STList* pos, STListType x)
{assert(pos);STList* newnode = BuyNode(x);STList* prev = pos->prev;newnode->next = pos;pos->prev = newnode;newnode->prev = prev;prev->next = newnode;
}
//在任意位置删除
void STListPosErase(STList* pos)
{assert(pos);STList* prev = pos->prev;STList* next = pos->next;prev->next = next;next->prev = prev;free(pos);
}
//销毁链表
void DesSTList(STList* phead)
{STList* cur = phead;while (cur != phead){STList* next = cur->next;free(cur);cur = next;}free(phead);
}

测试文件:

#define _CRT_SECURE_NO_WARNINGS 1
#include "STList.h"void test1()
{STList* phead = initSTList();STListPushBack(phead, 1);STListPushBack(phead, 2);STListPushBack(phead, 3);STListPushBack(phead, 4);STListPushBack(phead, 5);PrintSTList(phead);STListPushFront(phead, 5);STListPushFront(phead, 4);STListPushFront(phead, 3);STListPushFront(phead, 2);STListPushFront(phead, 1);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);STListPopBack(phead);PrintSTList(phead);DesSTList(phead);
}
void test2()
{STList* phead = initSTList();STListPushBack(phead, 1);STListPushBack(phead, 2);STListPushBack(phead, 3);STListPushBack(phead, 4);STListPushBack(phead, 5);PrintSTList(phead);STListPushFront(phead, 5);STListPushFront(phead, 4);STListPushFront(phead, 3);STListPushFront(phead, 2);STListPushFront(phead, 1);/*STListPopFront(phead);STListPopFront(phead);STListPopFront(phead);STListPopFront(phead);STListPopFront(phead);STListPopFront(phead);STListPopFront(phead);STListPopFront(phead);STListPopFront(phead);STListPopFront(phead);*/STList* pos = FindSTList(phead, 4);if (pos){STListPosInsert(pos, 40);}PrintSTList(phead);pos = FindSTList(phead, 40);if (pos){STListPosErase(pos);}PrintSTList(phead);
}int main()
{//test1();test2();return 0;
}

                                                

相关文章:

顺序表和链表的各种代码实现

一、线性表 在日常生活中&#xff0c;线性表的例子比比皆是。例如&#xff0c;26个英文字母的字母表&#xff08;A,B,C,……&#xff0c;Z&#xff09;是一个线性表&#xff0c;表中的数据元素式单个字母。在稍复杂的线性表中&#xff0c;一个数据元素可以包含若干个数据项。例…...

C# 介绍三种不同组件创建PDF文档的方式

1 c# 数据保存为PDF&#xff08;一&#xff09; &#xff08;spire pdf篇&#xff09; 2 c# 数据保存为PDF&#xff08;二&#xff09; &#xff08;Aspose pdf篇&#xff09; 3 c# 数据保存为PDF&#xff08;三&#xff09; &#xff08;PdfSharp篇&#xff09; 组件名称 绘制…...

极简面试题 --- Redis

什么是 Redis&#xff1f; Redis 是一个基于内存的键值存储系统&#xff0c;也被称为数据结构服务器。它支持多种数据结构&#xff0c;例如字符串、哈希表、列表、集合和有序集合&#xff0c;并且可以在内存中快速读写。 Redis 的优势有哪些&#xff1f; 快速&#xff1a;由…...

可视化图表API格式要求有哪些?Sugar BI详细代码示例(4)

Sugar BI中的每个图表可以对应一个数据 API&#xff0c;用户浏览报表时&#xff0c;选定一定的过滤条件&#xff0c;点击「查询」按钮将会通过 API 拉取相应的数据&#xff1b;前面说过&#xff0c;为了确保用户数据的安全性&#xff0c;Sugar BI上的所有数据请求都在Sugar BI的…...

学习vue(可与知乎合并)

一&#xff1a;组件及交互 1、什么是组件&#xff1f; 组件是可复用的 Vue 实例&#xff0c;且带有一个名字&#xff1a;在这个例子中是 。我们可以在一个通过 new Vue 创建的 Vue 根实例中&#xff0c;把这个组件作为自定义元素来使用&#xff1a; 声明组件 // 定义一个名…...

【UEFI实战】Linux下如何解析ACPI表

本文介绍如何在Linux下查看ACPI表示。使用的系统是Ubuntu18.04&#xff1a; Linux home 4.15.0-36-generic #39-Ubuntu SMP Mon Sep 24 16:19:09 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux 可以在如下的目录看到ACPI的基本信息&#xff1a; 但是默认的表都是不可以直接查看的&…...

Java-Redis持久化之RDB操作

Java-Redis持久化之RDB操作 1.为什么redis需要持久化&#xff1f;2.什么是RDB操作?3.请你用自己的话讲下RDB的过程?4.如何恢复rdb文件? 1.为什么redis需要持久化&#xff1f; Redis是内存数据库&#xff0c;如果不将内存数据库保存到磁盘&#xff0c;那么服务器进程退出&am…...

信号signal编程测试

信号会打断系统调用&#xff0c;慎用&#xff0c;就是用的时候测一测。 下面是信号的基础测试 信号 信号&#xff08;signal&#xff09;机制是UNIX系统中最为古老的进程之间的通信机制。它用于在一个或多个进程之间传递异步信号。信号可以由各种异步事件产生&#xff0c;例如…...

Linux学习记录——이십삼 进程信号(2)

文章目录 1、可重入函数2、volatile关键字3、如何理解编译器的优化4、SIGCHLD信号 1、可重入函数 两个执行流都执行一个函数时&#xff0c;这个函数就被重入了。比如同一个函数insert&#xff0c;在main中执行时&#xff0c;这个进程时间片到了&#xff0c;嵌入了内核&#xf…...

Revit中如何创建曲面嵌板及一键成板

一、Revit中如何创建曲面嵌板 在我们的绘图过程中可能会遇见一些曲面形状&#xff0c;而我们的常规嵌板没办法满足我们绘制的要求&#xff0c;我们今天学习如何在revit中绘制曲面嵌板。 1.新建“自适应公制常规模型”族&#xff0c;创建4个点图元并为其使用自适应。 2.在相同的…...

STM32F4_DHT11数字温湿度传感器

目录 前言 1. DHT11简介 2. DHT11数据结构 3. DHT11的传输时序 3.1 DHT11开始发送数据流程 3.2 主机复位信号和DHT11响应信号 3.3 数字 “0” 信号表示方法 3.4 数字 “1” 信号表示方法 4. 硬件分析 5. 实验程序详解 5.1 main.c 5.2 DHT11.c 5.3 DHT11.h 前言 DH…...

WiFi(Wireless Fidelity)基础(十一)

目录 一、基本介绍&#xff08;Introduction&#xff09; 二、进化发展&#xff08;Evolution&#xff09; 三、PHY帧&#xff08;&#xff08;PHY Frame &#xff09; 四、MAC帧&#xff08;MAC Frame &#xff09; 五、协议&#xff08;Protocol&#xff09; 六、安全&#x…...

操作系统—— 精髓与设计原理--期末复习

一、计算机系统概述 1、基本构成 计算机有四个主要的结构化部件&#xff1a; ①处理器&#xff08;Processor&#xff09;&#xff1a;控制计算机的操作&#xff0c;执行数据处理功能。当只有一个处理器时&#xff0c;它通常指中央处理器&#xff08;CPU&#xff09; ②内存…...

每天一道算法练习题--Day21 第一章 --算法专题 --- ----------位运算

我这里总结了几道位运算的题目分享给大家&#xff0c;分别是 136 和 137&#xff0c; 260 和 645&#xff0c; 总共加起来四道题。 四道题全部都是位运算的套路&#xff0c;如果你想练习位运算的话&#xff0c;不要错过哦&#xff5e;&#xff5e; 前菜 开始之前我们先了解下…...

D1. LuoTianyi and the Floating Islands (Easy Version)(树形dp)

Problem - D1 - Codeforces 这是问题的简化版本。唯一的区别在于在该版本中k≤min(n,3)。只有在两个版本的问题都解决后&#xff0c;才能进行黑客攻击。 琴音和漂浮的岛屿。 洛天依现在生活在一个有n个漂浮岛屿的世界里。这些漂浮岛屿由n−1个无向航线连接&#xff0c;任意两个…...

rk3588移植ubuntu server

ubuntu server 18.04 arm版本. 1、使用qemu运行 安装qemu-system-aarch64 sudo apt install -y qemu-system-arm 2、下载ubuntu server Index of /releases/18.04.3 3、创建虚拟磁盘 qemu-img create ubuntuimg.img 40G 4、创建虚拟机 弹出界面&#xff0c;直接回车选…...

如何更好地刷力扣

之前刷力扣是一口气看很多题目&#xff0c;打算时不时看一会题解&#xff0c;逐渐熟悉套路&#xff0c;争取背过&#xff0c;最后就可以写出来了。我个人是背知识比较喜欢这种方法&#xff0c;但后来发现根本不适用 算法题本身就比较复杂&#xff0c;不经过实际写代码中的思考…...

上采样和下采样

首先&#xff0c;谈谈不平衡数据集。不平衡数据集指的是训练数据中不同类别的样本数量差别较大的情况。在这种情况下&#xff0c;模型容易出现偏差&#xff0c;导致模型对数量较少的类别预测效果不佳。 为了解决这个问题&#xff0c;可以使用上采样和下采样等方法来调整数据集…...

小猪,信息论与我们的生活

前言 动态规划是大家都熟悉与陌生的知识&#xff0c;非常灵活多变&#xff0c;我自己也不敢说自己掌握了&#xff0c;今天给大家介绍一道题&#xff0c;不仅局限于动态规划做题&#xff0c;还会上升到信息论&#xff0c;乃至于启发自己认知世界的角度 因为比较难&#xff0c;本…...

【鸿蒙应用ArkTS开发系列】- http网络库使用讲解和封装

目录 前言http网络库组件介绍http网络库封装创建Har Module创建RequestOption 配置类创建HttpCore核心类创建HttpManager核心类对外组件导出添加网络权限 http网络库依赖和使用依赖http网络库&#xff08;httpLibrary&#xff09;使用http网络库&#xff08;httpLibrary&#x…...

UE5 学习系列(二)用户操作界面及介绍

这篇博客是 UE5 学习系列博客的第二篇&#xff0c;在第一篇的基础上展开这篇内容。博客参考的 B 站视频资料和第一篇的链接如下&#xff1a; 【Note】&#xff1a;如果你已经完成安装等操作&#xff0c;可以只执行第一篇博客中 2. 新建一个空白游戏项目 章节操作&#xff0c;重…...

Lombok 的 @Data 注解失效,未生成 getter/setter 方法引发的HTTP 406 错误

HTTP 状态码 406 (Not Acceptable) 和 500 (Internal Server Error) 是两类完全不同的错误&#xff0c;它们的含义、原因和解决方法都有显著区别。以下是详细对比&#xff1a; 1. HTTP 406 (Not Acceptable) 含义&#xff1a; 客户端请求的内容类型与服务器支持的内容类型不匹…...

逻辑回归:给不确定性划界的分类大师

想象你是一名医生。面对患者的检查报告&#xff08;肿瘤大小、血液指标&#xff09;&#xff0c;你需要做出一个**决定性判断**&#xff1a;恶性还是良性&#xff1f;这种“非黑即白”的抉择&#xff0c;正是**逻辑回归&#xff08;Logistic Regression&#xff09;** 的战场&a…...

通过Wrangler CLI在worker中创建数据库和表

官方使用文档&#xff1a;Getting started Cloudflare D1 docs 创建数据库 在命令行中执行完成之后&#xff0c;会在本地和远程创建数据库&#xff1a; npx wranglerlatest d1 create prod-d1-tutorial 在cf中就可以看到数据库&#xff1a; 现在&#xff0c;您的Cloudfla…...

如何在看板中体现优先级变化

在看板中有效体现优先级变化的关键措施包括&#xff1a;采用颜色或标签标识优先级、设置任务排序规则、使用独立的优先级列或泳道、结合自动化规则同步优先级变化、建立定期的优先级审查流程。其中&#xff0c;设置任务排序规则尤其重要&#xff0c;因为它让看板视觉上直观地体…...

渗透实战PortSwigger靶场-XSS Lab 14:大多数标签和属性被阻止

<script>标签被拦截 我们需要把全部可用的 tag 和 event 进行暴力破解 XSS cheat sheet&#xff1a; https://portswigger.net/web-security/cross-site-scripting/cheat-sheet 通过爆破发现body可以用 再把全部 events 放进去爆破 这些 event 全部可用 <body onres…...

蓝牙 BLE 扫描面试题大全(2):进阶面试题与实战演练

前文覆盖了 BLE 扫描的基础概念与经典问题蓝牙 BLE 扫描面试题大全(1)&#xff1a;从基础到实战的深度解析-CSDN博客&#xff0c;但实际面试中&#xff0c;企业更关注候选人对复杂场景的应对能力&#xff08;如多设备并发扫描、低功耗与高发现率的平衡&#xff09;和前沿技术的…...

《通信之道——从微积分到 5G》读书总结

第1章 绪 论 1.1 这是一本什么样的书 通信技术&#xff0c;说到底就是数学。 那些最基础、最本质的部分。 1.2 什么是通信 通信 发送方 接收方 承载信息的信号 解调出其中承载的信息 信息在发送方那里被加工成信号&#xff08;调制&#xff09; 把信息从信号中抽取出来&am…...

Mac下Android Studio扫描根目录卡死问题记录

环境信息 操作系统: macOS 15.5 (Apple M2芯片)Android Studio版本: Meerkat Feature Drop | 2024.3.2 Patch 1 (Build #AI-243.26053.27.2432.13536105, 2025年5月22日构建) 问题现象 在项目开发过程中&#xff0c;提示一个依赖外部头文件的cpp源文件需要同步&#xff0c;点…...

MySQL 索引底层结构揭秘:B-Tree 与 B+Tree 的区别与应用

文章目录 一、背景知识&#xff1a;什么是 B-Tree 和 BTree&#xff1f; B-Tree&#xff08;平衡多路查找树&#xff09; BTree&#xff08;B-Tree 的变种&#xff09; 二、结构对比&#xff1a;一张图看懂 三、为什么 MySQL InnoDB 选择 BTree&#xff1f; 1. 范围查询更快 2…...