diff options
Diffstat (limited to 'README.asciidoc')
-rw-r--r-- | README.asciidoc | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/README.asciidoc b/README.asciidoc index 3b3c9d7..d64ab13 100644 --- a/README.asciidoc +++ b/README.asciidoc @@ -155,7 +155,7 @@ approach this case by a simple way: * Let all the problem-solving classes inherit from `class ImplementInterface<T>` , and call the constructure with giving `identify` (type `T` ) . -* Create an object, type `RegisterInterface<T>` , and register all your +* Create an class inherit from `RegisterInterface<T>` , and register all your implement class to it by call `regImplement(pointer to the class)`. * Select which implement class you want by call `getImplement(identify)` , which will return the pointer to the corresponding class. @@ -226,34 +226,36 @@ you call `A.moveTo(&B)` ''' -=== meow:: *KD_Tree<Keys, Key, Value>* (C++ class) +=== meow:: *KD_Tree<Vector, Scalar>* (C++ class) .Description -`KD_Tree` is *K-dimension tree*, which is a dictionary(key->value). -Where the type if key is a *K-dimension vector* . +`KD_Tree` is *K-dimension tree*, which is a multiple set contain lots of +vector with K dimension. .Template Request -* `Keys` should has `operator[]` to allow the KD_Tree access the k-dimensions -* `Key` should has `operator*`, `operator+` +* `Vector` should has `operator[]` to allow the KD_Tree, `operator<` to +compare when two vector are point to the same place, `operator==` +access the k-dimensions +* `Scalar` should has `operator*`, `operator+`, `operator<` .Support Methods * N <- numbers of element in the kd-tree * K <- dimensions -* `Keys` is the tyepname of the vector -* `Key` is the typename of the element in the vector -* `Value` is the typename of value +* `Vector` is the tyepname of the vector +* `Vectors` is the typename of the std::vector<Vector> [options="header",width="100%",cols="1>,1<s,5<,1<,2<,10<",grid="rows"] |======================================================================= |Const?|Name| Parameters| Return Type| Time Complexity| Description |const|root|(size_t number)|size_t|very fast| -||insert|(Key const& k, Value v)|void|O(1)|Insert a pair (k->v) -|| build|()|void|O(KN logN) | Build the data structure(the `insert()` +||insert|(Vector const& v)|void|O(1)|Insert a vector +||erase |(Vector const& v)|bool|O(N*x)| Find a vector which is the same +as `v` and remove it from the KD_Tree, `x` in the Big-O time complex +is cost by `Vector::operator==`. +|| build|()|void|O(KN logN) if need | Build the data structure if need. +|| forceBuild|()|void|O(KN logN) | Build the data structure(the `insert()` method will not build the data structure immediately) -|const|query|(Keys const& point, int k)|Value|O(kN ^1-1/k^ ) | -Using Euclidean-Distance to find the k-nearest neighbor from `point` . -And return the corrosponding value -|const|query|(Keys const& point, int k)|std::vector<Value>|O(kN ^1-1/k^ ) | -Using Euclidean-Distance to find all the x-nearest neighbor from `point` , -where x <= k. And return an array of all the corrosponding value. +|const|query|(Vector const& v, int k)|Vectors|O(kN ^1-1/k^ ) | +Using Euclidean-Distance to find the 1st to k-th nearest neighbor from `v` . +And return; ||clear|()|O(1)|Clear all data ||reset|(size_t dimension)|O(1)|Clear all data and then set the this->dimension be `dimension` |