Is Pre-Order traversal on a binary tree same as Depth First Search?

Srikanth Kandalam picture Srikanth Kandalam · Feb 5, 2014 · Viewed 30k times · Source

It seems to me like Pre-order traversal and DFS are same as in both the cases we traverse till the leaf node in a depth wise fashion. Could anyone please correct me if I am wrong?

Thanks in advance!

Answer

herohuyongtao picture herohuyongtao · Feb 5, 2014

Pre-order is one type of DFS.

There are three types of depth-first traversal: pre-order, in-order, and post-order.

Check out here for more info.