I hereby claim:
- I am antoniopicone on github.
- I am antoniopicone (https://keybase.io/antoniopicone) on keybase.
- I have a public key ASAJ5jWz9KqkFfPTdFNu19S2fsxZuYA0ceUu8eizO8mYLwo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
var Heap = function(input) { | |
this.arrayLength = input.length ; | |
for(var j= Math.floor(this.arrayLength / 2);j>=0; j--) { | |
this.heapify(input,j); | |
console.log(j); | |
} |
<?php | |
function dijkstraRoute($matrix, $start, $stop) { | |
$Q = array(); // this will be the array containing the estimated cost to each node | |
$S = array(); //this set will have, for each key, the prevoious node and the cost to reach it | |
foreach (array_keys($matrix) as $node) $Q[$node] = 99999; // assume this value as infinite | |
$Q[$start] = 0; |
<?php | |
function bubbleSort($array) { | |
for($i=0;$i<sizeof($array);$i++) { | |
for($j=0;$j<sizeof($array)-1;$j++) { | |
if($array[$j]>$array[$j+1]) { | |
$temp = $array[$j]; | |
$array[$j] = $array[$j+1]; |
<?php | |
function quickSort($array) { | |
if(sizeof($array) <= 1) return $array; | |
$pivot = $array[0]; | |
$left = $right = array(); |
<?php | |
function mergeSort($array) { | |
if( sizeof($array) == 1 ) return $array; | |
$middle = floor(sizeof($array) / 2); | |
$l_arr = mergeSort( array_slice( $array, 0, $middle)); | |
$r_arr = mergeSort( array_slice( $array, $middle)); | |
$l_ptr = $r_ptr = $d_ptr = 0; |
<?php | |
class Node { | |
public $data; | |
public $next; | |
public function __construct($data) |
<?php | |
class GraphNode { | |
public $data; | |
public $adiacent_nodes; | |
public function __construct($data, $adiacent_nodes) | |
{ | |
$this->data = $data; |
<?php | |
class Node { | |
public $data; | |
public $next; | |
public function __construct($data) | |
{ | |
$this->data = $data; |
<?php | |
// check if a binary tree is balanced (it means | max-depth - min-depth | <= 1) as an AVL tree | |
// time complexity is O(N) , where N is the number of nodes | |
// space complexity iis O(h) , where h is the number of levels | |
class Node { |