Vladan Kozic
Vladan Kozic

Reputation: 1

Printing binary tree in Prolog

I am looking for a solution where I can print binary tree in prolog. I was thinking of using BFS, but I do not know how to write BFS in prolog. Tree must be printed like Father, then its Sons and so on.

Upvotes: 0

Views: 804

Answers (1)

catbow
catbow

Reputation: 55

It depends on the representation you use for your binary trees, but a solution can be to browse the binary tree with inorder transversal.

I suggest you have a look at tutorials such as the following: http://users.utcluj.ro/~cameliav/lp/lab8.pdf

Upvotes: 1

Related Questions