PHP Classes

PHP Array Sort and Search Algorithms: Search and sort arrays using common algorithms

Recommend this page to a friend!
  Info   View files Example   View files View files (8)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 66%Total: 314 All time: 7,256 This week: 136Up
Version License PHP version Categories
array-algorithms 1.1MIT/X Consortium ...5.0Algorithms, PHP 5, Searching, Data types
Description 

Author

This package search and sort arrays using common algorithms.

There is one class that can sort arrays using the algorithms bubble sort, comb sort, selection sort, heap sort and insertion sort.

Another class can implement array search algorithms like binary search, kmp search (Knuth-Morris-Pratt), and jump search.

Picture of Yousaf Syed
  Performance   Level  
Name: Yousaf Syed <contact>
Classes: 6 packages by
Country: Pakistan Pakistan
Age: 32
All time rank: 232931 in Pakistan Pakistan
Week rank: 100 Up3 in Pakistan Pakistan Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x

Example

<?php
include ('autoload.php');

$x = 4;
$list = array(5,2,3,4,1);


//Sort Algorithms examples
// $list = Algorithms\Sort::insertion_sort($list);
// $list = Algorithms\Sort::comb_sort($list);
// $list = Algorithms\Sort::selection_sort($list);
// $list = Algorithms\Sort::heap_sort($list);
// $list = Algorithms\Sort::bubble_sort($list);


// // Search Algorithms examples

// echo Algorithms\Search::binary_search($list, $x);
// echo Algorithms\Search::jump_search($x, $list);
// echo Algorithms\Search::kmp_search("ABC ABCDAB ABCDABCDABDE", "ABCDABD"); // 15


// Stack Example
// $stack = new Containers\Stack();
// $stack->push("hellow");
// $stack->push(2);
// $stack->push(3);
// $stack->push(4);
// $stack->push(5);
// echo $stack->top();




  Files folder image Files  
File Role Description
Files folder imagesrc (2 directories)
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file examples.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file readme.md Lic. Auxiliary data

  Files folder image Files  /  src  
File Role Description
Files folder imagealgorithms (2 files)
Files folder imagecontainers (1 file)

  Files folder image Files  /  src  /  algorithms  
File Role Description
  Plain text file Search.php Class Class source
  Plain text file Sort.php Class Class source

  Files folder image Files  /  src  /  containers  
File Role Description
  Plain text file Stack.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%
Total:314
This week:0
All time:7,256
This week:136Up
User Ratings User Comments (1)
 All time
Utility:93%StarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:-
Examples:93%StarStarStarStarStar
Tests:-
Videos:-
Overall:66%StarStarStarStar
Rank:572
 
Great library
8 years ago (Mubasher Ahmad)
70%StarStarStarStar