ImageVerifierCode 换一换
格式:DOCX , 页数:33 ,大小:20.96KB ,
资源ID:9645139      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/9645139.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(整理15确定性跳跃表Java实现.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

整理15确定性跳跃表Java实现.docx

1、整理15确定性跳跃表Java实现1-5确定性跳跃表Java实现作者:云南大学软件学院09数字媒体技术 雒森/* * To change this template, choose Tools | Templates * and open the template in the editor. */package LuoSen.DS.DS;import java.io.Serializable;/* * * author LENOVO */*确定性跳跃表链的结点*/public class DSLLinkNode implements Serializable /*跳跃表链结点的层数*/ pub

2、lic int levelNum=1; /*跳跃表链结点的数据*/ public S data; /*顶部的链*/ public DSLNode top; /*构造函数*/ public DSLLinkNode() data=null; top=null; /*构造函数*/ public DSLLinkNode(S data,DSLNode top) this.data=data; this.top=top; /*构造函数*/ public DSLLinkNode(S data,DSLNode top,int i) this.data=data; this.top=top; this.leve

3、lNum=i; /*判断节点是否相等*/ Override public boolean equals(Object o) if(this=o) return true; if(o=null|!(o instanceof DSLLinkNode) return false; DSLLinkNode a=(DSLLinkNode)o; if(data.equals(a.data) return true; return false; Override public int hashCode() int hash = 7; hash = 41 * hash + this.levelNum; has

4、h += 41 * hash + (this.data != null ? this.data.hashCode() : 0); return hash; Override public String toString() return +data; /* * To change this template, choose Tools | Templates * and open the template in the editor. */package LuoSen.DS.DS;import java.io.Serializable;/* * * author LENOVO */*确定性跳跃

5、表结点*/public class DSLNode implements Serializable /*向右的链*/ public DSLNode right; /*向下的链*/ public DSLNode down; /*确定性跳跃表链的结点*/ public DSLLinkNode link; /*默认构造函数*/ public DSLNode() right=down=null; link=null; /*构造函数*/ public DSLNode(DSLNode right) this.right=right; this.down=null; link=null; /*构造函数*/

6、public DSLNode(DSLNode right,DSLNode down) this.right=right; this.down=down; link=null; /*构造函数*/ public DSLNode(DSLNode right,DSLNode down,DSLNode top,int i) this.right=right; this.down=down; link=new DSLLinkNode(S)new Object(),top,i); /*构造函数*/ public DSLNode(DSLNode right,DSLNode down,DSLLinkNode l

7、ink) this.right=right; this.down=down; this.link=link; /*判断节点是否相等*/ Override public boolean equals(Object o) if(this=o) return true; if(o=null|!(o instanceof DSLNode) return false; DSLNode a=(DSLNode)o; if(link=a.link|(link!=null&link.equals(a.link) return true; return false; Override public int has

8、hCode() int hash = 7; hash = 47 * hash + (this.link != null ? this.link.hashCode() : 0); return hash; Override public String toString() if(link!=null) return link.toString(); else return ; /* * To change this template, choose Tools | Templates * and open the template in the editor. */package LuoSen.

9、DS.DS;import LuoSen.DS.Alg.Util.CreateComparator;import LuoSen.DS.Exceptions.IllegalParameterException;import java.io.Serializable;import java.util.Collection;import java.util.Comparator;import java.util.HashSet;import java.util.Iterator;import java.util.List;import java.util.Set;import java.util.lo

10、gging.Level;import java.util.logging.Logger;/* * * author 云大09数媒雒森 */*1-5确定性跳跃表*/public class DSkipList implements Serializable,Iterable /*头结点*/ protected DSLNode header; /*尾结点*/ protected DSLNode tailer=null; /*底结点*/ protected DSLNode bottom=null; /*表中元素的个数*/ protected int size=0; /*比较器*/ protected

11、 Comparator cp=null; /*构造函数*/ public DSkipList() bottom=null; tailer=null; header=new DSLNode(tailer,bottom,null, (byte)0); /*构造函数*/ public DSkipList(Comparator cp) bottom=null; tailer=null; header=new DSLNode(tailer,bottom,null,(byte)0); this.cp=cp; /*使用一个DSkipList跳表初始化,目的是将目标复制到当前表中*/ public boole

12、an initial(DSkipList dsl) if(dsl=null) return false; this.cp=dsl.cp; this.header=dsl.header; this.size=dsl.size; return true; /*返回跳跃表的头*/ public DSLNode getHeader() return header; /*设置比较器*/ public void setComparator(Comparator cp) this.cp=cp; /*返回比较器*/ public Comparator getComparator() return cp; /*

13、判断表中是否有关键字对应值*/ public boolean contain(S data) return this.search(data)!=null; /*查找数据为data的数据比较关键字封装在data中*/ public S search(S data) if(data=null|size=0) return null; DSLNode cur=header; while(cur!=bottom) while(cur.right!=tailer&pare(cur.right.link.data,data)0) cur=cur.right; if(cur.right!=tailer&p

14、are(cur.right.link.data,data)=0) return cur.right.link.data; cur=cur.down; return null; /*查找数据为data的数据比较关键字封装在data中,若查不到则返回位于它之后的第一个(最底部)结点*/ public DSLNode searchStart(S data) if(data=null|size=0) return null; DSLNode cur=header; while(cur!=bottom) while(cur.right!=tailer&pare(cur.right.link.data,d

15、ata)0) cur=cur.right; if(cur.down=bottom|(cur.right!=tailer& pare(cur.right.link.data,data)=0) cur=cur.right; if(cur!=tailer) while(cur.down!=bottom) cur=cur.down; return cur; cur=cur.down; return null; /*查找数据为data的数据比较关键字封装在data中,若查不到则返回位于它之前的第一个(最底部)结点*/ public DSLNode searchEnd(S data) if(data=nu

16、ll|size=0) return null; DSLNode cur=header; while(cur!=bottom) while(cur.right!=tailer&pare(cur.right.link.data,data)0) cur=cur.right; if(cur.down=bottom|(cur.right!=tailer& pare(cur.right.link.data,data)=0) cur=cur.right; if(cur!=tailer) while(cur.down!=bottom) cur=cur.down; if(cur.right!=tailer&pa

17、re(cur.right.link.data,data)=0) cur=cur.right; return cur; cur=cur.down; return null; /*插入数据data,若已存在返回数据链结点,并不插入数据,你可以在外面修改*/ public DSLLinkNode insert(S data) throws IllegalParameterException if(data=null) return null; if(cp=null) if(Comparable.class.isAssignableFrom(data.getClass() CreateComparat

18、or cc =new CreateComparator(); cp=cc.getComparator(); else throw new IllegalParameterException(数据不可以比较,请先设置比较器!); DSLNode cur=header; DSLNode newNode=null; while(cur!=bottom) while(cur.right!=tailer&pare(cur.right.link.data,data)0) cur=cur.right; if(cur.right!=tailer&pare(cur.right.link.data,data)=0

19、) newNode=cur.right; break; if(cur.down=bottom) newNode=new DSLNode(cur.right,bottom); newNode.link=new DSLLinkNode(data,newNode); cur.right=newNode; size+; break; else if(cur.down.right!=tailer&cur.down.right.right!=tailer &cur.down.right.right.right!=tailer& cur.down.right.right.right.right!=taile

20、r& cur.down.right.right.right.right.right!=tailer& (cur.right=tailer|pare(cur.down.right.right.right .right.right.link.data,cur.right.link.data)0) cur.right=new DSLNode(cur.right,cur.down.right.right.right,cur.down.right.right.right.link); cur.right.link.top=cur.right; cur.right.link.levelNum+; cur=

21、cur.down; if(header.right!=tailer) header.link.levelNum+; header.link.top=header; header=new DSLNode(tailer,header,header.link); return newNode.link; /*删除数据data*/ public boolean remove(S data) throws IllegalParameterException if(data=null|size=0) return false; if(cp=null) if(Comparable.class.isAssig

22、nableFrom(data.getClass() CreateComparator cc =new CreateComparator(); cp=cc.getComparator(); else throw new IllegalParameterException(数据不可以比较,请先设置比较器!); DSLNode cur=header; DSLNode c=null,cc=null,top=null; while(cur!=bottom) while(cur.right!=tailer&pare(cur.right.link.data,data)0) cur=cur.right; if

23、(cur.down=bottom&cur.right!=tailer&pare(cur.right.link.data,data)=0) if(size=1) header=new DSLNode(tailer,bottom,null,(byte)0); else if(cur.link.levelNumcur.right.link.levelNum)/比较左右位置结点层数高低,待删除的右边结点 c=cur.right.link.top; top=cur.right.link.top; cur.link.levelNum=cur.right.link.levelNum; while(c.dow

24、n!=cur.link.top.right) c.link=cur.link; c=c.down; c.link=cur.link; c.down=cur.link.top; c=cur.link.top.right; cc=cur.link.top; while(c!=bottom&cc!=bottom) cc.right=c.right; cc=cc.down; c=c.down; cur.link.top=top; else cc=cur.link.top; while(cc.right!=cur.right.link.top) cc=cc.down; c=cur.right.link.

25、top; while(c!=bottom&cc!=bottom) cc.right=c.right; cc=cc.down; c=c.down; size-; while(header.down!=bottom&header.down.right=tailer) header=header.down; header.link.levelNum-; header.link.top=header.down; return true; cur=cur.down; return false; /*获取条件一维区间odr之间的元素集合,该函数主要服务于:KDSkipList,用于检索一维区间*/ pub

26、lic Collection queryRegion(ODRegion odr) Set s=new HashSet(); if(odr.isNoHasCondition) DSLNode cur=header; while(cur.down!=bottom) cur=cur.down; cur=cur.right; while(cur!=tailer) if(cur.link.data instanceof KDSLNode) s.addAll(KDSLNode)cur.link.data).set); else s.add(cur.link.data); cur=cur.right; el

27、se DSLNode cur=header; DSLNode end=null; if(odr.start!=null) cur=this.searchStart(odr.start); else while(cur.down!=bottom) cur=cur.down; cur=cur.right; end=this.searchEnd(odr.end); if(cur=null|(cur!=null&end!=null&pare(cur.link.data, end.link.data)0) return s; while(cur!=end) if(cur.link.data instan

28、ceof KDSLNode) s.addAll(KDSLNode)cur.link.data).set); else s.add(cur.link.data); cur=cur.right; return s; /*获取条件一维区间odr之间的元素满足多维条件的数据集合,index为odr在qc中的位置, * 该函数主要服务于:MLDSkipList 用于检索多位区间*/ public Collection queryRegion(Collection s,ODRegion odr,int index ,ListODRegion qc,ListComparator cps) if(s=null) return s; if(odr.isNoHasCondition) DSLNode cur=header; while(cur.down!=b

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1