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

前端 未结 4 1034
情书的邮戳
情书的邮戳 2020-12-24 02:18

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

4条回答
  •  甜味超标
    2020-12-24 02:23

    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.

提交回复
热议问题