普通平衡树(块状链表)

本文介绍了使用块状链表实现普通平衡树的方法,相较于传统的平衡树实现,代码更为简洁。详细探讨了其原理和优势。
摘要由CSDN通过智能技术生成

实现了一下,比平衡树还是要短一些的。
AC Code:

#include<bits/stdc++.h>
#define S 1005
#define maxn 500005
#define nxt B[x].rb
using namespace std;

char cb[1<<18],*cs=cb,*ct=cb;
#define getc() (cs==ct&&(ct=(cs=cb)+fread(cb,1,1<<18,stdin),cs==ct)?0:*cs++)
inline void read(int &res){
   
	char ch;bool f=0;
	for(;!isdigit(ch=getc());) if(ch=='-') f=1;
	for(res=ch-'0';isdigit(ch=getc());res=res*10+ch-'0');
	(f) && (res = -res);
}

char pt[1<<18],*ps=pt;
inline void Push(char c){
   
	if(ps-pt==(1<<18)) printf("%s",pt),ps=pt;
	*ps++=c;
}
inline void put(int x){
   
	static int sta[20];
	if(!x) Push('0');
	if(x<0) Push('-'),x=-
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值