PHP Classes
elePHPant
Icontem

Binary search: Search for data in files using binary search

Recommend this page to a friend!
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2008-08-28 (11 years ago) RSS 2.0 feedStarStarStarStar 64%Total: 2,838 All time: 1,311 This week: 326Up
Version License PHP version Categories
binary_search 1.0Artistic License5.0Algorithms, PHP 5, Files and Folders, S...
Description Author

This class can be used to quickly search for sorted data in large files using the binary search algorithm.

It can search for a given identifier in a file that has lines that contain only the identifier and a value separated by a tab character.

The class uses the binary search algorithm to quickly narrow the search for a given identifier even when the files are very large.

Innovation Award
PHP Programming Innovation award winner
September 2008
Winner


Prize: One book of choice by Apress
Sometimes it is necessary to search a large amount of data for given information.

One way to reduce the time that is necessary to search the data is to store it in a file sorted by the key search values. Then we can used the binary search algorithm to quickly find the data in the file without having to load it all at once in memory.

This class implements the binary search algorithm in pure PHP code.

Manuel Lemos
Name: Alex Fourth is available for providing paid consulting. Contact Alex Fourth .
Classes: 1 package by
Country: Ukraine Ukraine
Age: 37
All time rank: 110819 in Ukraine Ukraine
Week rank: 686 Up12 in Ukraine Ukraine Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x

 

  Files folder image Files  
File Role Description
Plain text file binary_search.class.php Class Does all work
Accessible without login Plain text file test.php Example Example how to use the class
Accessible without login Plain text file data.csv Data Example data to search in

 Version Control Unique User Downloads Download Rankings  
 0%
Total:2,838
This week:0
All time:1,311
This week:326Up
User Ratings User Comments (1)
 All time
Utility:91%StarStarStarStarStar
Consistency:87%StarStarStarStarStar
Documentation:-
Examples:95%StarStarStarStarStar
Tests:-
Videos:-
Overall:64%StarStarStarStar
Rank:906
 
Nice work and very well coded.
11 years ago (David Ferreira)
70%StarStarStarStar