searching
Array searching module. This module provides Linear search and Binary search.
There are no constants.
binary_search()
— Perform Binary search for an array.search()
— Search the array for a given key (value). This function uses Linear search.There are no classes.
import searching
data = [2, 9, 10, 23, 5, 1, 12, 8]
key = 12
index = search(key, data)
if index != -1
writeln("Found at index " & index)
else
writeln("Not found!")
endif