Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

tree to array c++

int[size] array = new int[size]; 
int index = 0; 
void storeInOrder(node root) { 
	if (node == null) 
		return; 
	storeInOrder(root.leftChild()); 
	array[index++] = root.value; 
	storeInOrder(root.rightChild()); 
} 
 
PREVIOUS NEXT
Tagged: #tree #array
ADD COMMENT
Topic
Name
2+8 =