[英]Skip list on java extending AbstractMap
I need to implement skip list in java. 我需要在Java中实现跳过列表。 I know how skip list works, but i need to extend AbstractMap.
我知道跳过列表的工作原理,但是我需要扩展AbstractMap。 So class SkipList would look like
所以类SkipList看起来像
public class SkipList<K extends Comparable<K>,V> extends AbstractMap<K,V> {
public SkipList(int levels) {
// ...
}
// ...
}
I don't understand how i need to extend AbstractMap 我不明白我需要如何扩展AbstractMap
SkipList is used for fast search, usually with O(logn)
time complexity. SkipList用于快速搜索,通常具有
O(logn)
时间复杂度。 Standard JDK has no implementation of it. 标准JDK没有实现。 While ConcurrentSkipListMap is implemented using SkipList data structure, you can refer its source code: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/util/concurrent/ConcurrentSkipListMap.java#ConcurrentSkipListMap
当使用SkipList数据结构实现ConcurrentSkipListMap时 ,您可以引用其源代码: http : //grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8-b132/java/util/concurrent/ ConcurrentSkipListMap.java#ConcurrentSkipListMap
Here is another good example: https://codereview.stackexchange.com/questions/71432/custom-skiplist-implementation-in-java 这是另一个很好的例子: https : //codereview.stackexchange.com/questions/71432/custom-skiplist-implementation-in-java
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.