Algorithms_in_C++ 1.0.0
Set of algorithms implemented in C++.
|
Exponential search algorithm More...
#include <cassert>
#include <cmath>
#include <iostream>
#include <cstring>
Functions | |
template<class Type > | |
Type * | binary_s (Type *array, size_t size, Type key) |
template<class Type > | |
Type * | struzik_search (Type *array, size_t size, Type key) |
int | main () |
The algorithm try to search the range where the key should be. If it has been found we do a binary search there. The range of the search grows by exponential every time. If the key is larger than the last element of array, the start of block(block_front) will be equal to the end of block(block_size) and the algorithm return null ponter, every other cases the algoritm return fom the loop.
|
inline |
Binary Search Algorithm (used by struzik_search)
nullptr
if value not found int main | ( | void | ) |
Main function
Type * struzik_search | ( | Type * | array, |
size_t | size, | ||
Type | key ) |
Struzik Search Algorithm(Exponential)