Jump to content
Menyu yikuru
Menyu yikuru
move to sidebar
kubisa
Mayendelo
Jani likulu
Vidumbizgano vya chikaya
Vakuchitika vasono
Kusintha kuphya
Jani lililose
Wovwili
To Do
Vyakuti vinozgeke
Vinyake
Mafumbo
Mazgo ghakomi
Helpful Pages (Wovwili)
Need for Fix
Need for Review
Admin Pages
Home pages
Home templates
Kufufuza
Kufufuza
Kaonekelo
Chakupeleka
Panga akaunti
Njila
Vilwelo vyako
Chakupeleka
Panga akaunti
Njila
Pages for logged out editors
learn more
vyakulemba
Pakuchezgela
Kulemba
Module:Exponential search
Sazgapo viyowoyelo
Module
Kudumbizgana
English
Ŵelengani
Kulemba source
Kuona umo mayambilo
Vilwelo
Vilwelo
move to sidebar
kubisa
Vyakuchita
Ŵelengani
Kulemba source
Kuona umo mayambilo
Vya masiku ghose
Ivo vikwiza pano
Vyaku sintha
Kwezgela chinthu
Va jani lino
Penjani URL yakufupikizgika
Sangululani kodi ya QR
Kaonekelo
move to sidebar
kubisa
Chenjezgo:
Mundanjile mu akaunti yinu. Pala mulembenge chilichose IP adilesi yinu waliyose waionenge. Pala
mwanjila
mu akaunti yinu
panji
mwapanga akaunti
, vyakulemba vinu vyose viŵenge mu zina linu, na uwemi unyake.
Anti-spam check. Do
not
fill this in!
-- This module provides a generic exponential search algorithm. require[[strict]] local checkType = require('libraryUtil').checkType local floor = math.floor local function midPoint(lower, upper) return floor(lower + (upper - lower) / 2) end local function search(testFunc, i, lower, upper) if testFunc(i) then if i + 1 == upper then return i end lower = i if upper then i = midPoint(lower, upper) else i = i * 2 end return search(testFunc, i, lower, upper) else upper = i i = midPoint(lower, upper) return search(testFunc, i, lower, upper) end end return function (testFunc, init) checkType('Exponential search', 1, testFunc, 'function') checkType('Exponential search', 2, init, 'number', true) if init and (init < 1 or init ~= floor(init) or init == math.huge) then error(string.format( "invalid init value '%s' detected in argument #2 to " .. "'Exponential search' (init value must be a positive integer)", tostring(init) ), 2) end init = init or 2 if not testFunc(1) then return nil end return search(testFunc, init, 1, nil) end
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Kuleka
Wowili wakalembelo
(julani mu windo lanyuwani)
Preview page with this template
Nkhwaska yagwiliskika apa:
Module:Exponential search/doc
(
lemba
)
Kufufuza
Kufufuza
Kulemba
Module:Exponential search
Sazgapo viyowoyelo
Add topic