STL rope

STL rope是一种实现快速字符串插入、删除和查找的数据结构,时间复杂度为n*(n^0.5)。在g++的<ext/rope>头文件中提供了便捷的块状链表操作,如push_back、insert、erase、copy、replace和substr等。通过using namespace __gnu_cxx,可以使用类似于string的函数进行操作。
摘要由CSDN通过智能技术生成

Rope函数

类似指针链表的操作,时间复杂度会在n*(n^0.5),可以在很短的时间内实现快速的插入、删除和查找字符串

在g++头文件中,<ext/rope>中有成型的块状链表,在using namespace __gnu_cxx;空间中,类似string函数的操作其操作十分方便。

基本操作:

rope T;

T.push_back(x);//在末尾添加x

T.insert(pos,x);//在pos插入x

T.erase(pos,x);//从pos开始删除x个

T.copy(pos,len,x);//从pos开始到pos+len为止用x代替

T.replace(pos,x);//从pos开始换成x

T.substr(pos,x);//提取pos开始x个

T.at(x)/[x];//访问第x个元素

printf("%d\n",T[i])   cout<<T<<endl; 输出T[i] 输出T;

rope傻逼题?__?

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<ext/rope>
using namespace std;
using namespace __gnu_cxx;
const int maxn=2e5+7;
const int INF=0x3f3f3f3f;
const double ESP=1e-8;
int a[maxn];
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值