20240513,常用算法(查找,排序,拷贝替换)

news2024/10/6 18:23:00

做着一些和考试无关的事情

常用查找算法——续

FIND_IF 

find_if  //按条件查找元素,返回迭代器POS / END()
find_if(beg,end,_Fred)    _Fred函数或谓词(返回BOOL类型的仿函数)

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
//find_if  //按条件查找元素    find_if(beg,end,_Fred)_Fred函数或谓词(返回BOOL类型的仿函数)
class Greater {
public:
	bool operator()(int val) {
		return val>5;
	}
};
class Person {
public:
	Person(string n, int a) {
		this->_name = n;
		this->_age = a;
	}
	bool operator==(const Person& p) {
		if (this->_name == p._name && this->_age == p._age) {
			return true;
		}
		else {
			return false;
		}
	}
	string _name;
	int _age;
};
class Greater02 {
public:
	bool operator()(const Person &p) {
		return p._age==9;
	}
};
void test01() {
	vector<int>v;
	for (int i = 0; i < 10; i++) {
		v.push_back(i);
	}
	vector<int>::iterator it=find_if(v.begin(), v.end(), Greater());
	if (it == v.begin()) {
		cout << " no find" << endl;
	}
	else {
		cout << "find :  " <<*it<< endl;
	}
}
void test02() {
	vector<Person>p;
	Person p0("fsdef", 23);
	Person p1("复合工艺", 28);
	Person p2("粉色", 9);
	Person p3("得分·", 45);
	Person p4("啊上网服务", 53);
	p.push_back(p0);
	p.push_back(p1);
	p.push_back(p2);
	p.push_back(p3);
	p.push_back(p4);
	vector<Person>::iterator it = find_if(p.begin(), p.end(), Greater02());
	if (it == p.begin()) {
		cout << " no find" << endl;
	}
	else {
		cout << "find :  " << it->_name<<it->_age<< endl;
	}
}
int main() {
	test01();
	test02();
	return 0;
}
ADJACENT_FIND

adjacent_find  //查找相邻重复元素 
adjacent_find(begin,end)返回相邻元素的第一个的POS

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
//adjacent_find  //查找相邻重复元素   adjacent_find(begin,end)返回相邻元素的第一个的POS
class Person {
public:
	Person(string n, int a) {
		this->_name = n;
		this->_age = a;
	}
	bool operator==(const Person& p) {
		if (this->_name == p._name && this->_age == p._age) {
			return true;
		}
		else {
			return false;
		}
	}
	string _name;
	int _age;
};
void test01() {
	vector<int>v;
	v.push_back(0);
	v.push_back(1);
	v.push_back(0);
	v.push_back(3);
	v.push_back(3);
	vector<int>::iterator it = adjacent_find(v.begin(), v.end());
	if (it == v.begin()) {
		cout << " no find" << endl;
	}
	else {
		cout << "find :  " <<*it<< endl;
	}
}
void test02() {
	vector<Person>p;
	Person p1("复合工艺", 28);
	Person p2("粉色", 9);
	Person p3("得分·", 45);
	p.push_back(p2);
	p.push_back(p1);
	p.push_back(p2);
	p.push_back(p3);
	p.push_back(p3);
	vector<Person>::iterator it = adjacent_find(p.begin(), p.end());
	if (it == p.begin()) {
		cout << " no find" << endl;
	}
	else {
		cout << "find :  " << it->_name<<it->_age<< endl;
	}
}
int main() {
	test01();
	test02();
	return 0;
}
BINARY_SEARCH

binary_search  //二分法查找 
bool binary_search(beg,end,value)   //无序序列中不可用

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
//binary_search  //二分法查找   bool binary_search(beg,end,value)//无序序列中不可用

void test01() {
	vector<int>v;
	for (int i = 0; i < 10; i++) {
		v.push_back(i);
	}
	if (binary_search(v.begin(),v.end(),7)) {
		cout << " no find" << endl;
	}
	else {
		cout << "find :  " << endl;
	}
}
void test02() {
	
}
int main() {
	test01();
	test02();
	return 0;
}
COUNT

count  //统计元素个数   count(beg,end,value)

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
//count  //统计元素个数   count(beg,end,value)
class Person {
public:
	Person(string n, int a) {
		this->_name = n;
		this->_age = a;
	}
	bool operator==(const Person& p) {
		if (this->_name == p._name && this->_age == p._age) {
			return true;
		}
		else {
			return false;
		}
	}
	string _name;
	int _age;
};
void test01() {
	vector<int>v;
	v.push_back(0);
	v.push_back(0);
	v.push_back(0);
	v.push_back(3);
	v.push_back(3);
	int it=count(v.begin(), v.end(), 0);
	if (it==0) {
		cout << " no find" << endl;
	}
	else {
		cout << "find :  " <<it<<"   ge" << endl;
	}
}
void test02() {
	vector<Person>p;
	Person p1("复合工艺", 28);
	Person p2("粉色", 9);
	Person p3("得分·", 45);
	p.push_back(p2);
	p.push_back(p3);
	p.push_back(p2);
	p.push_back(p3);
	p.push_back(p3);
	int it = count(p.begin(), p.end(), p1);
	if (it == 0) {
		cout << " no find" << endl;
	}
	else {
		cout << "find :  " << it << "   ge" << endl;
	}
}
int main() {
	test01();
	test02();
	return 0;
}
COUNT_IF

count_if  //按条件统计元素个数    count_if(beg,end,——Pred)

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
//count_if  //按条件统计元素个数    count_if(beg,end,_Pred)
class grater {
public:
	bool operator()(int val) {
		return val > 5;
	}
};

class Person {
public:
	Person(string n, int a) {
		this->_name = n;
		this->_age = a;
	}
	/*bool operator==(const Person& p) {
		if (this->_name == p._name && this->_age == p._age) {
			return true;
		}
		else {
			return false;
		}
	}*/
	string _name;
	int _age;
};
class grater02 {
public:
	bool operator()(const Person &p) {
		return p._age > 5;
	}
};
void test01() {
	vector<int>v;
	for (int i = 0; i < 10; i++) {
		v.push_back(i);
	}
	int it=count_if(v.begin(), v.end(), grater());
	if (it==0) {
		cout << " no find" << endl;
	}
	else {
		cout << "find :  " <<it<<"   ge" << endl;
	}
}
void test02() {
	vector<Person>p;
	Person p2("粉色", 4);
	Person p3("得分·", 45);
	p.push_back(p2);
	p.push_back(p3);
	p.push_back(p2);
	p.push_back(p3);
	p.push_back(p3);
	int it = count_if(p.begin(), p.end(), grater02());
	if (it == 0) {
		cout << " no find" << endl;
	}
	else {
		cout << "find :  " << it << "   ge" << endl;
	}
}
int main() {
	test01();
	test02();
	return 0;
}

常用排序算法

sort  //对容器内元素进行排序
random_shuffle  //洗牌,指定范围内顺序变随机
merge  //容器元素合并,并存储道另一容器中
reverse  //反转指定范围的元素 

SORT

sort  //对容器内元素进行排序   sort(beg,end,_Pred/谓词)

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
/*
sort  //对容器内元素进行排序
sort(beg,end,_Pred/谓词)
*/
class grater {
public:
	bool operator()(int v1,int v2) {
		return v1>v2;
	}
};

class Person {
public:
	Person(string n, int a) {
		this->_name = n;
		this->_age = a;
	}
	/*bool operator==(const Person& p) {
		if (this->_name == p._name && this->_age == p._age) {
			return true;
		}
		else {
			return false;
		}
	}*/
	string _name;
	int _age;
};
class grater02 {
public:
	bool operator()(const Person &p1,const Person &p2) {
		return p1._age > p2._age;
	}
};
void test01() {
	vector<int>v;
	for (int i = 0; i < 10; i++) {
		v.push_back(i);
	}
	for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
		cout << *it << " ";
	}
	cout << endl;
	sort(v.begin(), v.end(), grater());
	for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
		cout << *it << " ";
	}
	cout << endl;
	v.push_back(3);
	sort(v.begin(), v.end(), greater<int>());
	for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
		cout << *it << " ";
	}
	cout << endl;
}
void test02() {
	vector<Person>v;
	Person p0("fsdef", 23);
	Person p1("复合工艺", 28);
	Person p2("粉色", 9);
	Person p3("得分·", 45);
	Person p4("啊上务", 53);
	v.push_back(p0);
	v.push_back(p1);
	v.push_back(p2);
	v.push_back(p3);
	v.push_back(p4);
	for (vector<Person>::iterator it = v.begin(); it != v.end(); it++) {
		cout <<"name: " << it->_name << "\tage:" << it->_age << endl;
	}
	cout << endl;
	sort(v.begin(), v.end(), grater02());
	for (vector<Person>::iterator it = v.begin(); it != v.end(); it++) {
		cout << "name: " << it->_name << "\tage:" << it->_age << endl;
	}
	cout << endl;
}
int main() {
	test01();
	test02();
	return 0;
}
RANDOM_SHUFFLE

random_shuffle  //洗牌,指定范围内顺序变随机   
random_shuffle(beg,end)——加上随机数种子

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<ctime>
using namespace std;

class Person {
public:
	Person(string n, int a) {
		this->_name = n;
		this->_age = a;
	}
	string _name;
	int _age;
};
void test01() {
	srand((unsigned int)time(NULL));//加上随机数种子
	vector<int>v;
	for (int i = 0; i < 10; i++) {
		v.push_back(i);
	}
	for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
		cout << *it << " ";
	}
	cout << endl;
	random_shuffle(v.begin(), v.end());
	for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
		cout << *it << " ";
	}
	cout << endl;
	
}
void test02() {
	srand((unsigned int)time(NULL));//加上随机数种子
	vector<Person>v;
	Person p0("fsdef", 2);
	Person p1("复合工艺", 28);
	Person p2("粉色", 29);
	Person p3("得分·", 45);
	Person p4("啊上务", 53);
	v.push_back(p0);
	v.push_back(p1);
	v.push_back(p2);
	v.push_back(p3);
	v.push_back(p4);
	for (vector<Person>::iterator it = v.begin(); it != v.end(); it++) {
		cout <<"name: " << it->_name << "\tage:" << it->_age << endl;
	}
	cout << endl;
	random_shuffle(v.begin(), v.end());
	for (vector<Person>::iterator it = v.begin(); it != v.end(); it++) {
		cout << "name: " << it->_name << "\tage:" << it->_age << endl;
	}
	cout << endl;
}
int main() {
	test01();
	test02();
	return 0;
}
MERGE

merge  //容器元素合并,并存储道另一容器中           PS:两个容器必须是有序的
merge(v1.beg ,v1.end ,v2.beg ,v2.end ,iterator dest)  iterator dest目标容器开始迭代器
自定义类型失败

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

void test01() {
	vector<int>v;
	vector<int>v1;
	vector<int>vv;
	for (int i = 0; i < 4; i++) {
		v.push_back(i);
	}
	for (int i = 0; i < 6; i++) {
		v1.push_back(i+7);
	}
	vv.resize(v.size() + v1.size());  //先开辟空间
	merge(v.begin(), v.end(), v1.begin(), v1.end(), vv.begin());
	for (vector<int>::iterator it = vv.begin(); it != vv.end(); it++) {
		cout << *it << " ";
	}
	cout << endl;
}

int main() {
	test01();
	return 0;
}
REVERSE

reverse  //反转指定范围的元素  reverse(beg,end)

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;

class Person {
public:
	Person() {};
	Person(string n, int a) {
		this->_name = n;
		this->_age = a;
	}
	string _name;
	int _age;
};
void test01() {
	vector<int>v;
	for (int i = 0; i < 10; i++) {
		v.push_back(i);
	}
	for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
		cout << *it << " ";
	}
	cout << endl << "revers after:" << endl;
	reverse(v.begin(), v.end());
	for (vector<int>::iterator it = v.begin(); it != v.end(); it++) {
		cout << *it << " ";
	}
	cout << endl;
}
void test02() {
	vector<Person>v;
	Person p0("fsdef", 2);
	Person p1("复合工艺", 28);
	Person p2("粉色", 29);
	Person p3("得分·", 45);
	Person p4("啊上务", 53);
	v.push_back(p0);
	v.push_back(p1);
	v.push_back(p2);
	v.push_back(p3);
	v.push_back(p4);
	for (vector<Person>::iterator it = v.begin(); it != v.end(); it++) {
		cout << "name: " << it->_name << "\tage:" << it->_age << endl;
	}
	cout << endl << "revers after:" << endl;
	reverse(v.begin(), v.end());
	for (vector<Person>::iterator it = v.begin(); it != v.end(); it++) {
		cout << "name: " << it->_name << "\tage:" << it->_age << endl;
	}
}
int main() {
	test01();
	test02();
	return 0;
}

常用拷贝和替换算法

copy  //容器内指定范围拷贝到另一容器中
replace  //指定范围 旧元素改为新元素
replace_if  //指定范围 旧元素替换为新元素
swap  //互换两个容器元素 

COPY

copy  //容器内指定范围拷贝到另一容器中      copy(beg,end,iterator dest) ---iterator dest目标起始迭代器

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
/*
copy(beg,end,iterator dest)
*/
void myprint(int val) {
	cout << val << "  ";
}
void test01() {
	vector<int>v;
	vector<int>v2;
	for (int i = 0; i < 10; i++) {
		v.push_back(i);
	}
	v2.resize(v.size());//开辟空间
	copy(v.begin(), v.end(),v2.begin());
	for_each(v2.begin(), v2.end(), myprint);
	cout << endl;
}
void test02() {
	
}
int main() {
	test01();
	test02();
	return 0;
}
REPLACE

replace  //指定范围 旧元素改为新元素     replace(beg,end,old val,new val)

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
/*
replace(beg,end,old val,new val)
*/
class Person {
public:
	Person() {};
	Person(string n, int a) {
		this->_name = n;
		this->_age = a;
	}
	bool operator==(const Person &p) {
		if (this->_name == p._name && this->_age == p._age) {
			return true;
		}
		else {
			return false;
		}
	}
	string _name;
	int _age;
};
void myprint(int val) {
	cout << val << "  ";
}
void myprint02(Person p) {
	cout << "name: " << p._name << "\tage:" << p._age << endl;
}
void test01() {
	vector<int>v;
	for (int i = 0; i < 10; i++) {
		int t = i;
		if ((t % 2) == 0) {
			v.push_back(i);
		}
		else {
			v.push_back(0);
		}
	}
	for_each(v.begin(), v.end(), myprint);
	cout << endl;
	replace(v.begin(), v.end(),0,3000);
	for_each(v.begin(), v.end(), myprint);
	cout << endl;
}
void test02() {
	vector<Person>v;
	Person p2("粉色", 29);
	Person p3("得  分·", 45);
	v.push_back(p2);
	v.push_back(p2);
	v.push_back(p3);
	for_each(v.begin(), v.end(), myprint02);
	cout << endl;
	replace(v.begin(), v.end(), p2, p3);
	for_each(v.begin(), v.end(), myprint02);
	cout << endl;
}
int main() {
	test01();
	test02();
	return 0;
}
REPLACE_IF

replace_if  //指定范围 旧元素替换为新元素        replace_if(beg,end,_pred,new val) 

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
/*
replace_if(beg,end,_pred,new val)
*/
class Person {
public:
	Person(string n, int a) {
		this->_name = n;
		this->_age = a;
	}
	bool operator==(const Person &p) {
		if (this->_name == p._name && this->_age == p._age) {
			return true;
		}
		else {
			return false;
		}
	}
	string _name;
	int _age;
};
void myprint(int val) {
	cout << val << "  ";
}
class greater5 {
public:
	bool operator()(int val) {
		return val > 5;
	}
};
class greater30 {
public:
	bool operator()(Person &p2) {
		return  p2._age<30;
	}
};
void myprint02(Person p) {
	cout << "name: " << p._name << "\tage:" << p._age << endl;
}
void test01() {
	vector<int>v;
	for (int i = 0; i < 10; i++) {
		v.push_back(i);
	}
	for_each(v.begin(), v.end(), myprint);
	cout << endl;
	replace_if(v.begin(), v.end(), greater5(), 3000);
	for_each(v.begin(), v.end(), myprint);
	cout << endl;
}
void test02() {
	vector<Person>v;
	Person p2("粉色", 29);
	Person p3("得  分·", 45);
	v.push_back(p2);
	v.push_back(p2);
	v.push_back(p3);
	for_each(v.begin(), v.end(), myprint02);
	cout << endl;
	replace_if(v.begin(), v.end(), greater30(), p3);
	for_each(v.begin(), v.end(), myprint02);
	cout << endl;
}
int main() {
	test01();
	test02();
	return 0;
}
SWAP

swap  //互换两个容器元素   swap(container c1,container c2)

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
using namespace std;
/*
replace_if(beg,end,_pred,new val)
*/
void myprint(int val) {
	cout << val << "  ";
}
void test01() {
	vector<int>v;
	vector<int>v1;
	for (int i = 0; i < 10; i++) {
		v.push_back(i);
		if(i<5){
			v1.push_back(0);
		}
	}
	cout << "swap before:" << endl;
	for_each(v.begin(), v.end(), myprint);
	cout << endl;
	for_each(v1.begin(), v1.end(), myprint);
	cout << endl;
	cout << "swap after:" << endl;
	swap(v, v1);
	for_each(v.begin(), v.end(), myprint);
	cout << endl;
	for_each(v1.begin(), v1.end(), myprint);
	cout << endl;
}
void test02() {
	
}
int main() {
	test01();
	test02();
	return 0;
}

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

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

相关文章

【逆天OP懒狗的JAVA自学笔记--5.判断和循环】第二阶段始篇

文章目录 前言一、流程控制语句1.顺序结构&#xff08;最简单&#xff09;2.分支结构2.1 if 语句2.1.1 if语句的三种格式2.1.2 if 的注意事项 2.2 switch 语句2.2.1switch 的扩展知识 3.循环结构3.1 for 循环 扩展小点&#xff1a;//1.求和的变量不能定义在循环的里面&#xff…

韵搜坊(全栈)-- 前后端初始化

文章目录 前端初始化后端初始化 前端初始化 使用ant design of vue 组件库 官网快速上手&#xff1a;https://www.antdv.com/docs/vue/getting-started-cn 安装脚手架工具 进入cmd $ npm install -g vue/cli # OR $ yarn global add vue/cli创建一个项目 $ vue create ant…

WPF使用ItemsControl显示Object的所有属性值

对于上位机开发&#xff0c;我们有时候有这样的需求&#xff1a;如何显示所有的IO点位&#xff1f;比如有10个IO点位&#xff0c;那我们要写10个TextBlock去绑定这10个点位的属性&#xff08;本文暂时不考虑显示的样式&#xff0c;当然也可以考虑&#xff09;&#xff0c;当点位…

OBS插件--图片或视频源随着声音动态缩放

音效动态调整 应用此插件的源可以根据音效声音的高低进行动态的缩放。在本例中&#xff0c;我们在当前的场景里面添加了一个小喇叭的图片源&#xff0c;在这个图片源上引用这款滤镜插件&#xff0c;然后将VLC视频源的音效用于此插件的音效。设置完成后&#xff0c;场景中的小喇…

blender导出gltf模型混乱

最近用户给了几个blender文件&#xff0c;在blender打开是这样的&#xff1a; 我导出成gltf候&#xff0c;在本地打开时&#xff0c;底部发生了改变&#xff1a; 可以看出来&#xff0c;底部由原来的类型box变为了两个平面&#xff0c;后来我查了下blender里的属性设置&#xf…

三更草堂前后端分离个人博客项目的开发笔记

文章目录 项目实战-前后端分离博客系统1.课程介绍2.创建工程3.博客前台3.0 准备工作3.1 SpringBoot和MybatisPuls整合配置测试 3.1 热门文章列表3.1.0 文章表分析3.1.1 需求3.1.2 接口设计3.1.3 基础版本代码实现3.1.4 使用VO优化3.1.5 字面值处理 3.2 Bean拷贝工具类封装3.2 查…

flink优化案例

文章目录 一、flink join维表案例二、flink 双流join案例三、总结 提示&#xff1a;以下是本篇文章正文内容&#xff0c;下面案例可供参考(适用于flink1.13) 一、flink join维表案例 背景:flink sql join 维表。job业务不复杂&#xff0c;job写入性能比较差。维表数据大约每天…

【ubuntu20.04运行python文件时,报错No module named ‘rospkg’】

**问题原因&#xff1a;**一般来说&#xff0c;并不是真的缺少rospkg&#xff0c;而是系统中存在多个python版本导致的混乱 检查python版本 Ubuntu20.04 —— pyhon3.8 sudo apt-get install python3.8最新版本&#xff0c;如下图所示 查看python3.8的位置 whereis python…

C++ | Leetcode C++题解之第88题合并两个有序数组

题目&#xff1a; 题解&#xff1a; class Solution { public:void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {int p1 m - 1, p2 n - 1;int tail m n - 1;int cur;while (p1 > 0 || p2 > 0) {if (p1 -1) {cur nums2[p2-…

让创意在幻觉中肆虐: 认识Illusion Diffusion AI

人工智能新境界 在不断发展的人工智能领域,一款非凡的新工具应运而生,它能将普通照片转化为绚丽的艺术品。敬请关注Illusion Diffusion,这是一个将现实与想象力完美融合的AI驱动平台,可创造出迷人的视错觉和超现实意境。 AI算法的魔力所在 Illusion Diffusion 的核心是借助先进…

每日OJ题_贪心算法四⑧_力扣767. 重构字符串

目录 力扣767. 重构字符串 解析代码 力扣767. 重构字符串 767. 重构字符串 难度 中等 给定一个字符串 s &#xff0c;检查是否能重新排布其中的字母&#xff0c;使得两相邻的字符不同。 返回 s 的任意可能的重新排列。若不可行&#xff0c;返回空字符串 "" 。 …

测试页打印失败。是否要参阅打印疑难解答以获得帮助?服务器打印后台处理程序服务没有运行。请重新启动服务器上的打印后台处理程序或重新启动服务器计算机。

问题&#xff1f; 测试页打印失败。是否要参阅打印疑难解答以获得帮助? 解决办法&#xff1a; 方法1、 请重新启动服务器上的打印后台处理程序或重新启动服务器计算机。 方法2、 找到services服务找到print spooler停止运行&#xff0c; C:\Windows\System32\spool -------…

回炉重造java----JVM

为什么要使用JVM ①一次编写&#xff0c;到处运行&#xff0c;jvm屏蔽字节码与底层的操作差异 ②自动内存管理&#xff0c;垃圾回收功能 ③数组下边越界检查 ④多态 JDK&#xff0c;JRE&#xff0c;JVM的关系 JVM组成部分 JVM的内存结构 《一》程序计数器(PC Register) 作用…

记录MySQL数据库查询不等于xxx时的坑

目录 一、背景 二、需求 三、方法 四、示例 一、背景 在使用MySQL数据库查询数据时&#xff0c;需要查询字段name不等于xxx的记录&#xff0c;通过where name ! xxx查询出来的记录不符合预期&#xff0c;通过检查发现少了name字段为null的记录&#xff0c;后经查询得知在My…

Python | Leetcode Python题解之第88题合并两个有序数组

题目&#xff1a; 题解&#xff1a; class Solution:def merge(self, nums1: List[int], m: int, nums2: List[int], n: int) -> None:"""Do not return anything, modify nums1 in-place instead."""p1, p2 m - 1, n - 1tail m n - 1whi…

【吃透Java手写】5-RPC-简易版

【吃透Java手写】RPC-简易版-源码解析 1 RPC1.1 RPC概念1.2 常用RPC技术或框架1.3 初始工程1.3.1 Productor-common&#xff1a;HelloService1.3.2 Productor&#xff1a;HelloServiceImpl1.3.3 Consumer 2 模拟RPC2.1 Productor2.2 模拟一个RPC框架2.2.1 HttpServer2.2.2 Http…

Elasticsearch解决字段膨胀问题

文章目录 背景Flattened类型的产生Flattened类型的定义基于Flattened类型插入数据更新Flattened字段并添加数据Flattened类型检索 Flattened类型的不足 背景 Elasticsearch映射如果不进行特殊设置&#xff0c;则默认为dynamic:true。dynamic:true实际上支持不加约束地动态添加…

【AI大模型】自动生成红队攻击提示--GPTFUZZER

本篇参考论文为&#xff1a; Yu J, Lin X, Xing X. Gptfuzzer: Red teaming large language models with auto-generated jailbreak prompts[J]. arXiv preprint arXiv:2309.10253, 2023. https://arxiv.org/pdf/2309.10253 一 背景 虽然LLM在今天的各个领域得到了广泛的运用…

AI办公自动化-用kimi自动清理删除重复文件

在kimichat中输入提示词&#xff1a; 你是一个Python编程专家&#xff0c;要完成一个编写Python脚本的任务&#xff0c;具体步骤如下&#xff1a; 1、打开文件夹D:\downloads&#xff1b; 2、哈希值比较比较里面所有的文件&#xff0c;如果文件相同&#xff0c;那么移动多余…

3D Gaussian Splatting for Real-Time Radiance Field Rendering 论文阅读

如此热门的项目&#xff0c;网络上有很多大牛分析了这篇文章的做法&#xff0c;在这里简单记录一下个人粗浅的理解。 关于各种数学表达式的推导&#xff0c;论文和参考资料中都提供了较为详细的解读&#xff0c;本人能力有限&#xff0c;这一部分理解不够深刻&#xff0c;先不做…