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

C语言链表操作

目录

链表基本操作

删除重复元素 

查找倒数第N个节点

查找中间节点

约瑟夫环

循环链表

合并有序链表

逆置链表

逆置链表(双向链表)


链表基本操作

//linklist.c#include "linklist.h"
#include <stdlib.h>struct node *head = NULL;
struct node *tail = NULL;void create_list(unsigned char elem)
{struct node *p = (struct node *)malloc(sizeof(struct node));p->elem = elem;p->next = NULL;if(head == NULL)head = p;elsetail->next = p;tail = p;
}void insert_node(int pos, unsigned char elem)
{struct node *pre;pre = head;int i = 0;struct node *p = (struct node *)malloc(sizeof(struct node));if(pos == 0){p->elem = elem;p->next = head;head = p;}else{while(i < pos - 1){pre = pre->next;i++;}p->elem = elem;p->next = pre->next;pre->next = p;if(p->next == NULL)tail = p;}
}void delete_node(int pos)
{struct node *pre, *p;pre = head;int i = 0;if(pos == 0){head = head->next;free(pre);}else{while(i < pos - 1){pre = pre->next;i++;}p = pre->next;pre->next = p->next;if(p->next == NULL)tail = pre;free(p);}
}void print_linklist(void)
{struct node *p;for(p = head; p; p = p->next)printf("%c", p->elem);printf("\n");
}int search(unsigned char elem)
{struct node *p;for(p = head; p; p = p->next)if(p->elem == elem)return 1;return 0;
}
//linklist.h#ifndef LINKLIST_H__
#define LINKLIST_H__#include <stdio.h>struct node
{unsigned char elem;struct node *next;
};void create_list(unsigned char elem);
void insert_node(int pos, unsigned char elem);
void delete_node(int pos);
void print_linklist(void);
int search(unsigned char elem);#endif
//main.c#include <stdio.h>
#include "linklist.h"int main(void)
{create_list('A');create_list('B');create_list('C');create_list('D');print_linklist();delete_node(0);print_linklist();insert_node(0, 'F');insert_node(2, 'Z');print_linklist();if(search('C'))printf("the elem is found in the linklist\n");elseprintf("Can not find it\n");return 0;
}

删除重复元素 

//linklist.c#include "linklist.h"
#include <stdlib.h>struct node *head = NULL;
struct node *tail = NULL;void create_list(unsigned int elem)
{struct node *p = (struct node *)malloc(sizeof(struct node));p->elem = elem;p->next = NULL;if(head == NULL)head = p;elsetail->next = p;tail = p;
}void insert_node(int pos, unsigned int elem)
{struct node *pre;pre = head;int i = 0;struct node *p = (struct node *)malloc(sizeof(struct node));if(pos == 0){p->elem = elem;p->next = head;head = p;}else{while(i < pos - 1){pre = pre->next;i++;}p->elem = elem;p->next = pre->next;pre->next = p;if(p->next == NULL)tail = p;}
}void delete_node(int pos)
{struct node *pre, *p;pre = head;int i = 0;if(pos == 0){head = head->next;free(pre);}else{while(i < pos - 1){pre = pre->next;i++;}p = pre->next;pre->next = p->next;if(p->next == NULL)tail = pre;free(p);}
}void print_linklist(struct node *linklist_head)
{struct node *p;for(p = linklist_head; p; p = p->next)printf("%5d", p->elem);printf("\n");
}int search(unsigned int elem)
{struct node *p;for(p = head; p; p = p->next)if(p->elem == elem)return 1;return 0;
}void delete_repeat(struct node *head)
{int flag[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};struct node *p = head;struct node *q = NULL;flag[p->elem] = 1;while(p->next != NULL){if(flag[p->next->elem] == 0){flag[p->next->elem] = 1;p = p->next;}else{q = p->next;p->next = q->next;free(q);}}
}
//linklist.h#ifndef LINKLIST_H__
#define LINKLIST_H__#include <stdio.h>extern struct node *head;
extern struct node *tail;struct node
{unsigned int elem;struct node *next;
};void create_list(unsigned int elem);
void insert_node(int pos, unsigned int elem);
void delete_node(int pos);
void print_linklist(struct node *linklist_head);
int search(unsigned int elem);
void delete_repeat(struct node *head);#endif
//main.c#include <stdio.h>
#include "linklist.h"int main(void)
{create_list(1);create_list(2);create_list(8);create_list(2);create_list(3);create_list(9);create_list(4);create_list(6);create_list(4);create_list(8);create_list(7);create_list(5);create_list(2);create_list(9);create_list(6);print_linklist(head);delete_repeat(head);print_linklist(head);return 0;
}

查找倒数第N个节点

//linklist.c#include "linklist.h"
#include <stdlib.h>struct node *head = NULL;
struct node *tail = NULL;void create_list(unsigned int elem)
{struct node *p = (struct node *)malloc(sizeof(struct node));p->elem = elem;p->next = NULL;if(head == NULL)head = p;elsetail->next = p;tail = p;
}void insert_node(int pos, unsigned int elem)
{struct node *pre;pre = head;int i = 0;struct node *p = (struct node *)malloc(sizeof(struct node));if(pos == 0){p->elem = elem;p->next = head;head = p;}else{while(i < pos - 1){pre = pre->next;i++;}p->elem = elem;p->next = pre->next;pre->next = p;if(p->next == NULL)tail = p;}
}void delete_node(int pos)
{struct node *pre, *p;pre = head;int i = 0;if(pos == 0){head = head->next;free(pre);}else{while(i < pos - 1){pre = pre->next;i++;}p = pre->next;pre->next = p->next;if(p->next == NULL)tail = pre;free(p);}
}void print_linklist(struct node *linklist_head)
{struct node *p;for(p = linklist_head; p; p = p->next)printf("%5d", p->elem);printf("\n");
}int search(unsigned int elem)
{struct node *p;for(p = head; p; p = p->next)if(p->elem == elem)return 1;return 0;
}int find_mid(struct node *linklist_head)
{struct node *p;struct node *q;p = q = linklist_head;while(p != NULL && p->next != NULL){p = p->next->next;q = q->next;}return q->elem;
}int find_last_nth(struct node *linklist_head, int n)
{int i;struct node *p;struct node *q;p = q = linklist_head;for(i = 0; i < n-1; i++)p = p->next;while(p->next != NULL){p = p->next;q = q->next;}return q->elem;
}
//linklist.h#ifndef LINKLIST_H__
#define LINKLIST_H__#include <stdio.h>extern struct node *head;
extern struct node *tail;struct node
{unsigned int elem;struct node *next;
};void create_list(unsigned int elem);
void insert_node(int pos, unsigned int elem);
void delete_node(int pos);
void print_linklist(struct node *linklist_head);
int search(unsigned int elem);
int find_mid(struct node *linklist_head);
int find_last_nth(struct node *linklist_head, int n);#endif
//main.c#include <stdio.h>
#include "linklist.h"int main(void)
{int n;create_list(1);create_list(2);create_list(3);create_list(4);create_list(5);create_list(6);create_list(7);create_list(8);create_list(9);create_list(10);print_linklist(head);printf("Please enter the last one you want to show:");scanf("%d", &n);printf("the last n :%d\n", find_last_nth(head, n));return 0;
}

查找中间节点

//linklist.c#include "linklist.h"
#include <stdlib.h>struct node *head = NULL;
struct node *tail = NULL;void create_list(unsigned int elem)
{struct node *p = (struct node *)malloc(sizeof(struct node));p->elem = elem;p->next = NULL;if(head == NULL)head = p;elsetail->next = p;tail = p;
}void insert_node(int pos, unsigned int elem)
{struct node *pre;pre = head;int i = 0;struct node *p = (struct node *)malloc(sizeof(struct node));if(pos == 0){p->elem = elem;p->next = head;head = p;}else{while(i < pos - 1){pre = pre->next;i++;}p->elem = elem;p->next = pre->next;pre->next = p;if(p->next == NULL)tail = p;}
}void delete_node(int pos)
{struct node *pre, *p;pre = head;int i = 0;if(pos == 0){head = head->next;free(pre);}else{while(i < pos - 1){pre = pre->next;i++;}p = pre->next;pre->next = p->next;if(p->next == NULL)tail = pre;free(p);}
}void print_linklist(struct node *linklist_head)
{struct node *p;for(p = linklist_head; p; p = p->next)printf("%5d", p->elem);printf("\n");
}int search(unsigned int elem)
{struct node *p;for(p = head; p; p = p->next)if(p->elem == elem)return 1;return 0;
}int find_mid(struct node *linklist_head)
{struct node *p;struct node *q;p = q = linklist_head;while(p != NULL && p->next != NULL){p = p->next->next;q = q->next;}return q->elem;
}
//linklist.h#ifndef LINKLIST_H__
#define LINKLIST_H__#include <stdio.h>extern struct node *head;
extern struct node *tail;struct node
{unsigned int elem;struct node *next;
};void create_list(unsigned int elem);
void insert_node(int pos, unsigned int elem);
void delete_node(int pos);
void print_linklist(struct node *linklist_head);
int search(unsigned int elem);
int find_mid(struct node *linklist_head);#endif
//main.c#include <stdio.h>
#include "linklist.h"int main(void)
{create_list(1);create_list(2);create_list(3);create_list(4);create_list(5);create_list(6);create_list(7);create_list(8);create_list(9);create_list(10);print_linklist(head);printf("mid = %d\n", find_mid(head));return 0;
}

约瑟夫环

约瑟夫问题是个著名的问题:N个人围成一圈,第一个人从1开始报数,报M的将被杀掉,下一个人接着从1开始报。如此反复,最后剩下一个,求最后的胜利者。
例如只有三个人,把他们叫做A、B、C,他们围成一圈,从A开始报数,假设报2的人被杀掉。

●首先A开始报数,他报1。侥幸逃过一劫。
●然后轮到B报数,他报2。非常惨,他被杀了
●C接着从1开始报数
●接着轮到A报数,他报2。也被杀死了。
●最终胜利者是C

//linklist.c#include "linklist.h"
#include <stdlib.h>struct node *head = NULL;
struct node *tail = NULL;void create_list(unsigned int elem)
{struct node *p = (struct node *)malloc(sizeof(struct node));p->elem = elem;p->next = NULL;if(head == NULL)head = p;elsetail->next = p;tail = p;tail->next = head;
}void insert_node(int pos, unsigned int elem)
{struct node *pre;pre = head;int i = 0;struct node *p = (struct node *)malloc(sizeof(struct node));if(pos == 0){p->elem = elem;p->next = head;head = p;tail->next = head;}else{while(i < pos - 1){pre = pre->next;i++;}p->elem = elem;p->next = pre->next;pre->next = p;if(p->next == head)tail = p;}
}void delete_node(int pos)
{struct node *pre, *p;pre = head;int i = 0;if(pos == 0){head = head->next;free(pre);tail->next = head;}else{while(i < pos - 1){pre = pre->next;i++;}p = pre->next;pre->next = p->next;if(p->next == head)tail = pre;free(p);}
}void print_linklist(void)
{struct node *p;p = head;//	for(p = head; p != head; p = p->next)
//		printf("%d", p->elem);do{printf("%5d", p->elem);p = p->next;}while(p != head);printf("\n");
}int search(unsigned int elem)
{struct node *p;p = head;//	for(p = head; p; p = p->next)
//		if(p->elem == elem)
//			return 1;do{if(p->elem == elem)return 1;p = p->next;}while(p != head);return 0;
}
//linklist.h#ifndef LINKLIST_H__
#define LINKLIST_H__#include <stdio.h>extern struct node *head;
extern struct node *tail;struct node
{unsigned int elem;struct node *next;
};void create_list(unsigned int elem);
void insert_node(int pos, unsigned int elem);
void delete_node(int pos);
void print_linklist(void);
int search(unsigned int elem);#endif
//main.c#include <stdio.h>
#include "linklist.h"
#include <stdlib.h>int main(void)
{int n, k, m;int i;struct node *p, *q;printf("Please enter the number of person:");scanf("%d", &n);for(i = 1; i <= n; i++)create_list(i);print_linklist();p = head;printf("Please enter the start num:");scanf("%d", &k);while(--k)p = p->next;
//	printf("p->elem = %d\n", p->elem);printf("Please enter the m:");scanf("%d", &m);if(1 == m){for(i = 0; i < n; i++){printf("%3d", p->elem);p = p->next;}printf("\n");}else{while(n--){for(i = 1; i < m - 1; i++)p = p->next;q = p;p = p->next;printf("%3d", p->elem);q->next = p->next;free(p);p = p->next;}printf("\n");}return 0;
}

循环链表

//linklist.c#include "linklist.h"
#include <stdlib.h>struct node *head = NULL;
struct node *tail = NULL;void create_list(unsigned int elem)
{struct node *p = (struct node *)malloc(sizeof(struct node));p->elem = elem;p->next = NULL;if(head == NULL)head = p;elsetail->next = p;tail = p;tail->next = head;
}void insert_node(int pos, unsigned int elem)
{struct node *pre;pre = head;int i = 0;struct node *p = (struct node *)malloc(sizeof(struct node));if(pos == 0){p->elem = elem;p->next = head;head = p;tail->next = head;}else{while(i < pos - 1){pre = pre->next;i++;}p->elem = elem;p->next = pre->next;pre->next = p;if(p->next == head)tail = p;}
}void delete_node(int pos)
{struct node *pre, *p;pre = head;int i = 0;if(pos == 0){head = head->next;free(pre);tail->next = head;}else{while(i < pos - 1){pre = pre->next;i++;}p = pre->next;pre->next = p->next;if(p->next == head)tail = pre;free(p);}
}void print_linklist(void)
{struct node *p;p = head;//	for(p = head; p != head; p = p->next)
//		printf("%d", p->elem);do{printf("%5d", p->elem);p = p->next;}while(p != head);printf("\n");
}int search(unsigned int elem)
{struct node *p;p = head;//	for(p = head; p; p = p->next)
//		if(p->elem == elem)
//			return 1;do{if(p->elem == elem)return 1;p = p->next;}while(p != head);return 0;
}
//linklist.h#ifndef LINKLIST_H__
#define LINKLIST_H__#include <stdio.h>struct node
{unsigned int elem;struct node *next;
};void create_list(unsigned int elem);
void insert_node(int pos, unsigned int elem);
void delete_node(int pos);
void print_linklist(void);
int search(unsigned int elem);#endif
//main.c#include <stdio.h>
#include "linklist.h"int main(void)
{create_list(1);create_list(2);create_list(3);create_list(4);create_list(5);create_list(6);create_list(7);print_linklist();insert_node(0, 11);print_linklist();delete_node(6);print_linklist();delete_node(0);print_linklist();delete_node(0);print_linklist();delete_node(4);print_linklist();insert_node(0, 8);print_linklist();insert_node(5, 9);print_linklist();insert_node(2, 13);print_linklist();return 0;
}

合并有序链表

//linklist.c#include "linklist.h"
#include <stdlib.h>struct node *head = NULL;
struct node *tail = NULL;void create_list(unsigned int elem)
{struct node *p = (struct node *)malloc(sizeof(struct node));p->elem = elem;p->next = NULL;if(head == NULL)head = p;elsetail->next = p;tail = p;
}void insert_node(int pos, unsigned int elem)
{struct node *pre;pre = head;int i = 0;struct node *p = (struct node *)malloc(sizeof(struct node));if(pos == 0){p->elem = elem;p->next = head;head = p;}else{while(i < pos - 1){pre = pre->next;i++;}p->elem = elem;p->next = pre->next;pre->next = p;if(p->next == NULL)tail = p;}
}void delete_node(int pos)
{struct node *pre, *p;pre = head;int i = 0;if(pos == 0){head = head->next;free(pre);}else{while(i < pos - 1){pre = pre->next;i++;}p = pre->next;pre->next = p->next;if(p->next == NULL)tail = pre;free(p);}
}void print_linklist(struct node *linklist_head)
{struct node *p;for(p = linklist_head; p; p = p->next)printf("%5d", p->elem);printf("\n");
}int search(unsigned int elem)
{struct node *p;for(p = head; p; p = p->next)if(p->elem == elem)return 1;return 0;
}
//linklist.h#ifndef LINKLIST_H__
#define LINKLIST_H__#include <stdio.h>extern struct node *head;
extern struct node *tail;struct node
{unsigned int elem;struct node *next;
};void create_list(unsigned int elem);
void insert_node(int pos, unsigned int elem);
void delete_node(int pos);
void print_linklist(struct node *linklist_head);
int search(unsigned int elem);#endif
//main.c#include <stdio.h>
#include "linklist.h"int main(void)
{struct node *head1 = NULL;struct node *head2 = NULL;struct node *p = NULL;  //head1struct node *q = NULL;	//head2create_list(1);create_list(9);create_list(13);create_list(27);head1 = head;print_linklist(head1);head = NULL;create_list(3);create_list(5);create_list(14);create_list(81);create_list(88);create_list(95);create_list(99);head2 = head;print_linklist(head2);head = NULL;p = head1;q = head2;while(p && q){if(p->elem <= q->elem){if(head == NULL)head = p;elsetail->next = p;tail = p;p = p->next;}else{if(head == NULL)head = q;elsetail->next = q;tail = q;q = q->next;}}tail->next = p?p:q;print_linklist(head);return 0;
}

逆置链表

//linklist.c#include "linklist.h"
#include <stdlib.h>struct node *head = NULL;
struct node *tail = NULL;void create_list(unsigned int elem)
{struct node *p = (struct node *)malloc(sizeof(struct node));p->elem = elem;p->next = NULL;if(head == NULL)head = p;elsetail->next = p;tail = p;
}void insert_node(int pos, unsigned int elem)
{struct node *pre;pre = head;int i = 0;struct node *p = (struct node *)malloc(sizeof(struct node));if(pos == 0){p->elem = elem;p->next = head;head = p;}else{while(i < pos - 1){pre = pre->next;i++;}p->elem = elem;p->next = pre->next;pre->next = p;if(p->next == NULL)tail = p;}
}void delete_node(int pos)
{struct node *pre, *p;pre = head;int i = 0;if(pos == 0){head = head->next;free(pre);}else{while(i < pos - 1){pre = pre->next;i++;}p = pre->next;pre->next = p->next;if(p->next == NULL)tail = pre;free(p);}
}void print_linklist(struct node *linklist_head)
{struct node *p;for(p = linklist_head; p; p = p->next)printf("%5d", p->elem);printf("\n");
}int search(unsigned int elem)
{struct node *p;for(p = head; p; p = p->next)if(p->elem == elem)return 1;return 0;
}int find_mid(struct node *linklist_head)
{struct node *p;struct node *q;p = q = linklist_head;while(p != NULL && p->next != NULL){p = p->next->next;q = q->next;}return q->elem;
}int find_last_nth(struct node *linklist_head, int n)
{int i;struct node *p;struct node *q;p = q = linklist_head;for(i = 0; i < n-1; i++)p = p->next;while(p->next != NULL){p = p->next;q = q->next;}return q->elem;
}void reverse_linklist(struct node *linklist_head)
{struct node *p, *n;p = linklist_head->next;linklist_head->next = NULL;while(p->next != NULL){n = p->next;p->next = linklist_head;linklist_head = p;p = n;}p->next = linklist_head;linklist_head = p;head = linklist_head;
}
//linklist.h#ifndef LINKLIST_H__
#define LINKLIST_H__#include <stdio.h>extern struct node *head;
extern struct node *tail;struct node
{unsigned int elem;struct node *next;
};void create_list(unsigned int elem);
void insert_node(int pos, unsigned int elem);
void delete_node(int pos);
void print_linklist(struct node *linklist_head);
int search(unsigned int elem);
int find_mid(struct node *linklist_head);
int find_last_nth(struct node *linklist_head, int n);
void reverse_linklist(struct node *linklist_head);#endif
//main.c#include <stdio.h>
#include "linklist.h"int main(void)
{int n;create_list(1);create_list(2);create_list(3);create_list(4);create_list(5);create_list(6);create_list(7);create_list(8);create_list(9);create_list(10);print_linklist(head);reverse_linklist(head);print_linklist(head);return 0;
}

逆置链表(双向链表)

//linklist.c#include "linklist.h"
#include <stdlib.h>struct node *head = NULL;
struct node *tail = NULL;void create_list(unsigned int elem)
{struct node *p = (struct node *)malloc(sizeof(struct node));p->elem = elem;p->pre = NULL;p->next = NULL;if(head == NULL)head = p;else{tail->next = p;p->pre = tail;}tail = p;
}void insert_node(int pos, unsigned int elem)
{struct node *pre;pre = head;int i = 0;struct node *p = (struct node *)malloc(sizeof(struct node));if(pos == 0){p->elem = elem;p->next = head;head->pre = p;p->pre = NULL;head = p;}else{while(i < pos - 1){pre = pre->next;i++;}p->elem = elem;p->pre = pre;p->next = pre->next;if(p->next != NULL)pre->next->pre = p; pre->next = p;if(p->next == NULL)tail = p;}
}void delete_node(int pos)
{struct node *pre, *p;pre = head;int i = 0;if(pos == 0){head = head->next;head->pre = NULL;free(pre);}else{while(i < pos - 1){pre = pre->next;i++;}p = pre->next;pre->next = p->next;if(p->next != NULL)p->next->pre = pre;else//if(p->next == NULL)tail = pre;free(p);}
}void print_linklist(void)
{struct node *p;for(p = head; p; p = p->next)printf("%5d", p->elem);printf("\n");
}int search(unsigned int elem)
{struct node *p;for(p = head; p; p = p->next)if(p->elem == elem)return 1;return 0;
}void reverse_print_linklist(void)
{struct node *p;for(p = tail; p; p = p->pre)printf("%5d", p->elem);printf("\n");
}
//linklist.h#ifndef LINKLIST_H__
#define LINKLIST_H__#include <stdio.h>struct node
{unsigned int elem;struct node *pre;struct node *next;
};void create_list(unsigned int elem);
void insert_node(int pos, unsigned int elem);
void delete_node(int pos);
void print_linklist(void);
int search(unsigned int elem);
void reverse_print_linklist(void);#endif
//main.c#include <stdio.h>
#include "linklist.h"int main(void)
{create_list(1);create_list(2);create_list(3);create_list(4);create_list(5);create_list(6);create_list(7);print_linklist();reverse_print_linklist();
/*insert_node(0, 11);print_linklist();delete_node(6);print_linklist();delete_node(0);print_linklist();delete_node(0);print_linklist();delete_node(4);print_linklist();insert_node(0, 8);print_linklist();insert_node(5, 9);print_linklist();insert_node(2, 13);print_linklist();
*/	return 0;
}

相关文章:

C语言链表操作

目录 链表基本操作 删除重复元素 查找倒数第N个节点 查找中间节点 约瑟夫环 循环链表 合并有序链表 逆置链表 逆置链表(双向链表) 链表基本操作 //linklist.c#include "linklist.h" #include <stdlib.h>struct node *head NULL; struct node *tail…...

详解拦截器和过滤器

目录 代码演示过滤器Demo拦截器Demo 过滤器自定义拦截器配置拦截器过滤器执行原理多个过滤器的执行顺序 拦截器自定义拦截器注册拦截器1&#xff09;注册拦截器2&#xff09;配置拦截的路径3&#xff09;配置不拦截的路径 多个拦截器的执行顺序 过滤器和拦截器的区别 代码演示 …...

关于`IRIS/Caché`进程内存溢出解决方案

文章目录 关于IRIS/Cach进程内存溢出解决方案 描述原因相关系统变量$ZSTORAGE$STORAGE 什么情况下进程内存会变化&#xff1f;内存不足原理解决方案 关于 IRIS/Cach进程内存溢出解决方案 描述 在IRIS/Cach中&#xff0c;进程内存溢出错误是指一个进程&#xff08;例如运行中的…...

构建Docker容器监控系统(cadvisor+influxDB+grafana)

目录 一、部署 1、安装docker-cd 2、阿里云镜像加速 3、下载组件镜像 4、创建自定义网络 5、创建influxdb容器 6、创建Cadvisor 容器 7、创建granafa容器 一、部署 1、安装docker-cd [rootlocalhost ~]# iptables -F [rootlocalhost ~]# setenforce 0 setenforce: SELi…...

最强自动化测试框架Playwright(17)- 模拟接口

模拟接口 介绍 Web API 通常作为 HTTP 终结点实现。Playwright提供了API来模拟和修改网络流量&#xff0c;包括HTTP和HTTPS。页面所做的任何请求&#xff0c;包括 XHR 和获取请求&#xff0c;都可以被跟踪、修改和模拟。使用Playwright&#xff0c;您还可以使用包含页面发出的…...

Python爬虫——requests_get请求

import requests# ?可加可不加 url http://www.baidu.com/s?headers {Cookie: ,User-Agent: , }data {wd: 北京 } # params 参数 response requests.get(urlurl, paramsdata, headersheaders)content response.text print(content)总结&#xff1a; 参数使用params传递…...

【EI复现】一种建筑集成光储系统规划运行综合优化方法(Matlab代码实现)

&#x1f4a5;&#x1f4a5;&#x1f49e;&#x1f49e;欢迎来到本博客❤️❤️&#x1f4a5;&#x1f4a5; &#x1f3c6;博主优势&#xff1a;&#x1f31e;&#x1f31e;&#x1f31e;博客内容尽量做到思维缜密&#xff0c;逻辑清晰&#xff0c;为了方便读者。 ⛳️座右铭&a…...

C++11 异步与通信之 std::async

概念简介 std::async 异步运行一个函数&#xff0c;将返回值保存在std::future中。 含有2个策略参数&#xff1a; launch::deferred 延迟执行&#xff0c;当调用wait()和get()时&#xff0c;任务才会被运行&#xff0c;且不创建线程&#xff1b;launch::async : 创建线程并执…...

影视站用什么cms好?

影视站是指用于提供电影、电视剧、综艺等视频资源的网站。由于影视站需要频繁更新大量的内容&#xff0c;因此使用一个好的内容管理系统&#xff08;CMS&#xff09;非常重要。以下是几个受欢迎的影视站CMS的介绍。最新下载地址&#xff1a;roulang WordPress WordPress是目前…...

HOT88-乘积最大子数组

leetcode原题链接&#xff1a;乘积最大子数组 题目描述 给你一个整数数组 nums &#xff0c;请你找出数组中乘积最大的非空连续子数组&#xff08;该子数组中至少包含一个数字&#xff09;&#xff0c;并返回该子数组所对应的乘积。测试用例的答案是一个 32-位 整数。子数组 是…...

工博士与纷享销客达成战略合作,开启人工智能领域合作新篇章

近日&#xff0c;工博士与纷享销客在上海正式签署了战略合作协议&#xff0c;正式拉开了双方在人工智能与数字营销领域的合作序幕。这次合作将为双方带来更多机遇和发展空间&#xff0c;并为全球人工智能领域的客户提供更高效、智能的CRM解决方案。 < 双方项目人员合影 >…...

拆解与重构:慕云游首页组件化设计

目录 前言1 项目准备1.1 创建项目目录1.2 搭建项目开发环境 2 项目组件化2.1 在当前环境启动原有项目2.2 顶部组件2.3 幻灯片组件2.4 机酒自由行组件2.5 拆分余下的css文件 3 项目完善3.1 幻灯片组件3.1.1 结构和样式3.1.2 功能实现3.1.3 使用Ajax获取数据3.1.4 加载中组件 3.2…...

刷了3个月的华为OD算法题,刷出感觉了,如洁柔般丝滑,文末送《漫画算法2:小灰的算法进阶》

目录 一、考研二战&#xff0c;入职华为&#xff0c;反向调剂电子科大深圳下面分享一道2023 B卷 朋友抽中题 简易内存池&#xff1a;二、题目描述三、输入描述四、输出描述样例&#xff1a;输出样例&#xff1a; 五、解题思路六、Java算法源码七、效果展示1、输入2、输出3、说明…...

ip转换器哪个好用 ip地址切换器有哪些

在互联网时代&#xff0c;IP转换器成为了实现高效工作的常见工具。而如今&#xff0c;市面上涌现出了众多的IP转换器软件&#xff0c;使得用户在选择时感到困惑。本文将介绍一种深度IP转换器软件&#xff0c;探讨其特点和优势&#xff0c;以及与其他软件相比的差异&#xff0c;…...

【python】爬取豆瓣电影Top250(附源码)

前言 在网络爬虫的开发过程中&#xff0c;经常会遇到需要处理一些反爬机制的情况。其中之一就是网站对于频繁访问的限制&#xff0c;即IP封禁。为了绕过这种限制&#xff0c;我们可以使用代理IP来动态改变请求的来源IP地址。在本篇博客中&#xff0c;将介绍如何使用代理IP的技术…...

35岁职业危机?不存在!体能断崖?不担心

概述 90年&#xff0c;硕士毕业&#xff0c;干了快8年的Java开发工作。现年33岁&#xff0c;再过2年就要35岁。 工作这些年&#xff0c;断断续续也看过不少35岁找不到工作&#xff0c;转行&#xff0c;降薪入职的传闻、案例。 35岁&#xff0c;甚至30岁之后&#xff0c;体能…...

C语言——指针进阶

本章重点 字符指针数组指针指针数组数组传参和指针传参函数指针函数指针数组指向函数指针数组的指针回调函数指针和数组面试题的解析 1. 字符指针 在指针的类型中我们知道有一种指针类型为字符指针 char* int main() { char ch w; char *pc &ch; *pc w; return 0; }…...

heap pwn 入门大全 - 1:glibc heap机制与源码阅读(上)

本文为笔者学习heap pwn时&#xff0c;学习阅读glibc ptmalloc2源码时的笔记&#xff0c;与各位分享。可能存在思维跳跃或错误之处&#xff0c;敬请见谅&#xff0c;欢迎在评论中指出。本文也借用了部分外网和其他前辈的素材图片&#xff0c;向各位表示诚挚的感谢&#xff01;如…...

树莓派RP2040 用Arduino IDE安装和编译

目录 1 Arduino IDE 1.1 IDE下载 1.2 安装 arduino mbed os rp2040 boards 2 编程-烧录固件 2.1 打开点灯示例程序 2.2 选择Raspberry Pi Pico开发板 2.3 编译程序 2.4 烧录程序 2.4.1 Raspberry Pi Pico开发板首次烧录提示失败 2.4.2 解决首次下载失败问题 2.4.2.1…...

云安全攻防(八)之 Docker Remote API 未授权访问逃逸

Docker Remote API 未授权访问逃逸 基础知识 Docker Remote API 是一个取代远程命令行界面&#xff08;rcli&#xff09;的REST API&#xff0c;其默认绑定2375端口&#xff0c;如管理员对其配置不当可导致未授权访问漏洞。攻击者利用 docker client 或者 http 直接请求就可以…...

从WWDC看苹果产品发展的规律

WWDC 是苹果公司一年一度面向全球开发者的盛会&#xff0c;其主题演讲展现了苹果在产品设计、技术路线、用户体验和生态系统构建上的核心理念与演进脉络。我们借助 ChatGPT Deep Research 工具&#xff0c;对过去十年 WWDC 主题演讲内容进行了系统化分析&#xff0c;形成了这份…...

【入坑系列】TiDB 强制索引在不同库下不生效问题

文章目录 背景SQL 优化情况线上SQL运行情况分析怀疑1:执行计划绑定问题?尝试:SHOW WARNINGS 查看警告探索 TiDB 的 USE_INDEX 写法Hint 不生效问题排查解决参考背景 项目中使用 TiDB 数据库,并对 SQL 进行优化了,添加了强制索引。 UAT 环境已经生效,但 PROD 环境强制索…...

MODBUS TCP转CANopen 技术赋能高效协同作业

在现代工业自动化领域&#xff0c;MODBUS TCP和CANopen两种通讯协议因其稳定性和高效性被广泛应用于各种设备和系统中。而随着科技的不断进步&#xff0c;这两种通讯协议也正在被逐步融合&#xff0c;形成了一种新型的通讯方式——开疆智能MODBUS TCP转CANopen网关KJ-TCPC-CANP…...

2025盘古石杯决赛【手机取证】

前言 第三届盘古石杯国际电子数据取证大赛决赛 最后一题没有解出来&#xff0c;实在找不到&#xff0c;希望有大佬教一下我。 还有就会议时间&#xff0c;我感觉不是图片时间&#xff0c;因为在电脑看到是其他时间用老会议系统开的会。 手机取证 1、分析鸿蒙手机检材&#x…...

【Zephyr 系列 10】实战项目:打造一个蓝牙传感器终端 + 网关系统(完整架构与全栈实现)

🧠关键词:Zephyr、BLE、终端、网关、广播、连接、传感器、数据采集、低功耗、系统集成 📌目标读者:希望基于 Zephyr 构建 BLE 系统架构、实现终端与网关协作、具备产品交付能力的开发者 📊篇幅字数:约 5200 字 ✨ 项目总览 在物联网实际项目中,**“终端 + 网关”**是…...

鸿蒙中用HarmonyOS SDK应用服务 HarmonyOS5开发一个生活电费的缴纳和查询小程序

一、项目初始化与配置 1. 创建项目 ohpm init harmony/utility-payment-app 2. 配置权限 // module.json5 {"requestPermissions": [{"name": "ohos.permission.INTERNET"},{"name": "ohos.permission.GET_NETWORK_INFO"…...

稳定币的深度剖析与展望

一、引言 在当今数字化浪潮席卷全球的时代&#xff0c;加密货币作为一种新兴的金融现象&#xff0c;正以前所未有的速度改变着我们对传统货币和金融体系的认知。然而&#xff0c;加密货币市场的高度波动性却成为了其广泛应用和普及的一大障碍。在这样的背景下&#xff0c;稳定…...

Linux C语言网络编程详细入门教程:如何一步步实现TCP服务端与客户端通信

文章目录 Linux C语言网络编程详细入门教程&#xff1a;如何一步步实现TCP服务端与客户端通信前言一、网络通信基础概念二、服务端与客户端的完整流程图解三、每一步的详细讲解和代码示例1. 创建Socket&#xff08;服务端和客户端都要&#xff09;2. 绑定本地地址和端口&#x…...

Xen Server服务器释放磁盘空间

disk.sh #!/bin/bashcd /run/sr-mount/e54f0646-ae11-0457-b64f-eba4673b824c # 全部虚拟机物理磁盘文件存储 a$(ls -l | awk {print $NF} | cut -d. -f1) # 使用中的虚拟机物理磁盘文件 b$(xe vm-disk-list --multiple | grep uuid | awk {print $NF})printf "%s\n"…...

CSS设置元素的宽度根据其内容自动调整

width: fit-content 是 CSS 中的一个属性值&#xff0c;用于设置元素的宽度根据其内容自动调整&#xff0c;确保宽度刚好容纳内容而不会超出。 效果对比 默认情况&#xff08;width: auto&#xff09;&#xff1a; 块级元素&#xff08;如 <div>&#xff09;会占满父容器…...