User:J.smith/pseudocode

int TotalPages

pointer DiffList[TotalPages, 3] // List of [oldID][Date][User] for page in question

int PagesLeft = TotalPages-1 // Total pages left in question

int PageNumberToCheck = PagesLeft/2 // Pointer to where we are at in the list, initialized to middle

pointer PageToCheck // The page that needs to be checked

bool IsFound // TRUE/FALSE return for if LastPageChecked had string

string SearchString // String of text we are searching for

bool CheckPage(page, string) // Checks page for string and return boolean true if found (uses Qurey.php to grab wikimarkup and does a search/find for the string (to be writen))

While (PagesLeft > 1){ // If PagesLeft is more than 1, then keep searching.

PageToCheck = DiffList[PageNumberToCheck, 0]

IsFound = CheckPage(PageToCheck, SearchString)

PagesLeft = PagesLeft/2

If (IsFound = TRUE) //If "checkpage" resulted in a "positive"

PageNumberToCheck = PageNumberToCheck - (PagesLeft/2)

Else //If "checkpage" resulted in a "negative"

PageNumberToCheck = PageNumberToCheck + (PagesLeft/2)

}

PageToCheck = DiffList[PageNumberToCheck, 0]

IsFound = CheckPage(PageToCheck, SearchString)

If (IsFound = TRUE)

Return (PageNumberToCheck)

Else

Return (PageNumberToCheck+1)