Exemplo n.º 1
0
 <?
 include_once('/var/www/html/src/php/CDPriorityQueue.php');

 $PQ = new CDPriorityQueue();
 $PQ -> insert('A',1);
 $PQ -> insert('B',4);
 $PQ -> insert('C',2);
 $PQ -> insert('D',3);
 $PQ -> insert('F',10);
 echo $PQ -> top();

?>
Exemplo n.º 2
0
	
	$debug = false;
	// if($debug) echo "rows: ".$rowsintable."<br>";
	$nextRow = 0;
	//If the matchID is empty and the match doesn't exist
	if($matchID == '' && !$Match->exists)
	{
		//Set the user to not matched
		$User->setMatched(false);
	
		//Get the last checked row
		$lastRow = $User->row['lastRow'];
		$nextRow = $lastRow++;

		//making a PQ
		$PQ = new CDPriorityQueue();

		$stillMatching = true;
		while($stillMatching)
		{
			//Skip if self
			if($nextRow == $User->row['row'])
			$nextRow++;
			
			if($nextRow > $maxRow)
			$nextRow = 0;
		
			$nextUser = new User($nextRow, $PDOconn);
			if($testing) $nextUser->istest = true;
			$nextUser->refreshMatched();