Skip to content

danlex/expressions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

$str = '(10 + 20) + (1 + 3 * 2 / (1+1))';
$strPostfix = $evaluator->getConvertor()->strInfixToStrPostfix($str);
echo($evaluator->evaluateStrPostfix($strPostfix));
$expressionTree = $evaluator->getConvertor()->strInfixToExpressionTree($str);
echo ($evaluator->evaluateExpressionTree($expressionTree));

##QuickSort

$unsortedArray = array(4, 2, 2, 1, 3, 7, 3, 9, 5);
$sortInstance = Sort_QuickSort::getInstance();
$sortedArray = $sortInstance->sort($unsortedArray);
print_r($sortedArray);

##QuickSort with 2 pivots

$unsortedArray = array(4, 2, 2, 1, 3, 7, 3, 9, 5);
$sortInstance = Sort_QuickSort2Pivot::getInstance();
$sortedArray = $sortInstance->sort($unsortedArray);
print_r($sortedArray);

##Tests for sorting algorithms To run one test

$ cd Tests
$ phpunit --configuration phpunit-sort-suite.xml

##Expressions

$str = '(10 + 20) + (1 + 3 * 2 / (1+1))';
$strPostfix = $evaluator->getConvertor()->strInfixToStrPostfix($str);
echo($evaluator->evaluateStrPostfix($strPostfix));
$expressionTree = $evaluator->getConvertor()->strInfixToExpressionTree($str);
echo ($evaluator->evaluateExpressionTree($expressionTree));

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages