is there a heap t storing seven distinct elements such that a preorder traversal of t yields the elements of t in sorted order? how about an inorder traversal? how about a postorder traversal?

Respuesta :

Yes, there is a heap t storing seven distinct elements such that a preorder traversal of t yields the elements of t in sorted order. However, in inorder traversal and postorder traversal, there is no heap t storing seven distinct elements.

In a binary tree system, preorder traversal is used to make a duplicate of the tree. It is also utilized to obtain the prefix expression.

If there is a (min-heap) TT storing seven distinct elements such that a preorder traversal of TT yields the elements of TT in sorted order;

Then, the image attached below shows the description of the preorder traversal in sorted order.

In an inorder traversal, the parent is always listed after its left child. However, in a (min-heap), the parent is usually smaller than the left child. As such, the smaller parent is normally listed after its left child. Hence, inorder traversal of a (min-heap) is not usually sorted in order.

The same scenario for inorder traversal is true for postorder traversal, thus postorder traversal of a (min-heap) is not usually sorted in order.

Learn more about preorder traversal here:

https://brainly.com/question/14289989?referrer=searchResults

Ver imagen ajeigbeibraheem