• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

kstars

  • sources
  • kde-4.12
  • kdeedu
  • kstars
  • kstars
  • htmesh
SkipList.h
Go to the documentation of this file.
1 #ifndef _SkipList_H
2 #define _SkipList_H
3 
4 /*
5  SkipList.h
6 
7  See: Pugh, William, "Skip Lists: A Probabilistic Alternative to Balanced Trees"
8 
9 */
10 #include <limits.h> // INT_MAX
11 #include <SkipListElement.h>
12 
13 #define SKIPLIST_NOT_FOUND -1
14 
15 class SkipListElement;
16 
17 class LINKAGE SkipList{
18 public:
19  SkipList(float probability = 0.5);
20  ~SkipList();
21 
23  void insert(const Key searchKey, const Value value);
25  Key findMAX(const Key searchKey) const;
27  Key findMIN(const Key searchKey) const;
28  /* ITERATOR SUPPRT */
29  void reset() {iter = myHeader->getElement(0);}
30  int step() {
31  iter = iter->getElement(0); return (iter != NIL);
32  }
33 
34  Key getkey() {
35  if (iter != NIL)
36  return iter->getKey();
37  else
38  return (Key) -1;
39  }
40 
41  Value getvalue() {
42  if (iter != NIL)
43  return iter->getValue();
44  else
45  return (Value) -1;
46  }
47 
49  void free(const Key searchKey);
50  void freeRange(const Key loKey, const Key hiKey);
51 
53  void stat();
54 
55 private:
56  float myProbability;
58  SkipListElement* myHeader;
59  SkipListElement* iter;
60  long myLength;
61 };
62 
63 #endif // _SkipList_H
SkipListElement
Definition: SkipListElement.h:35
SkipList::step
int step()
Definition: SkipList.h:30
Value
int Value
Definition: SkipListElement.h:31
SkipList::reset
void reset()
Definition: SkipList.h:29
NIL
#define NIL
Definition: SkipListElement.h:18
SkipListElement.h
SkipList::getvalue
Value getvalue()
Definition: SkipList.h:41
SkipList::getkey
Key getkey()
Definition: SkipList.h:34
Key
int64 Key
Definition: SkipListElement.h:30
SkipList
Definition: SkipList.h:17
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:36:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kstars

Skip menu "kstars"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal