Domanda di colloquio di Splunk

How would you print the nodes in a tree using DFS?

Risposta di colloquio

Anonimo

23 feb 2014

void dfs(struct node *root) { if(root == null) { return; } else { dfs(root->left); printf("element: %d",root->data ); dfs(root->right); } }