Jump to content
Main menu
Main menu
move to sidebar
hide
འགྲུལ་བསྐྱོད།
མ་ཤོག།
མི་སྡེའི་སྒོ་ར།
འཕྲལ་གྱི་བསྒྱུར་བཅོས
གང་འབྱུང་ཤོག་ལེབ།
གྲོགས་རམ།
དམིགས་བསལ་ཤོག་ལེབ།
འཚོལ་ཞིབ།
འཚོལ་ཞིབ།
Appearance
ཕན་འདེབས།
ནང་བསྐྱོད
ནང་བསྐྱོད།
རང་དོན་ལག་ཆས།
ཕན་འདེབས།
ནང་བསྐྱོད
ནང་བསྐྱོད།
Pages for logged out editors
learn more
Contributions
Talk
Module:Exponential search
ཞུན་དག་འབད་དོ།
Add languages
Module
གྲོས་བསྡུར།
English
ལྷག
Edit source
View history
ལག་ཆས་ཚུ་
Tools
move to sidebar
hide
ལས་སྣ་ཚུ་
ལྷག
Edit source
View history
General
ནཱ་ལུ་ ག་ཅི་འབྲེལ་མཐུད་འོང་ནི་མས།
འབྲེལ་བ་ཅན་གྱི་བསྒྱུར་བཅོས།
ཡིག་སྣོད་སྐྱེལ་བཙུགས་འབད།
ཤོག་ངོས་བརྡ་དོན།
Get shortened URL
Download QR code
Appearance
move to sidebar
hide
ཉེན་བརྡ:
ཁྱོད་ཀྱིས་ ནང་བསྐྱོད་མ་འབད་བས། ཁྱོད་ཀྱི་ ཨའི་པི་ཁ་བྱང་འདི་ ཤོག་ལེབ་ཀྱི་ཞུན་དག་སྤྱོད་ཤུལ་འདི་ནང་ ཐོ་བཀོད་འབད་དེ་བཞག་འོང་།
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
བཅུད་དོན།:
By saving 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.
ཆ་མེད་གཏང་།
ཞུན་དག་གྲོགས་རམ།
(ཝིན་ཌོ་གསརཔ་ནང་ ཁ་ཕྱེཝ་ཨིན།)
Preview page with this template
ཤོག་ལེབ་འདི་གུ་ལག་ལེན་འཐབ་ཡོད་པའི་ཊེམ་པེལེཊི:
Template:High-use
(
edit
)
Template:High use
(
edit
)
Module:Exponential search/doc
(
edit
)
Module:High-use
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/E
(
edit
)
Module:Yesno
(
edit
)
འཚོལ་ཞིབ།
འཚོལ་ཞིབ།
Module:Exponential search
ཞུན་དག་འབད་དོ།
Add languages
Add topic