answersLogoWhite

0


Best Answer

Use depth-first traversal. By convention, binary trees place lower values in the left branch and larger or equal values in the right branch. Given any node in the tree (starting from the root), output all the values to the right of that node, then output the node's value, and finally output all the values to the left of that node. The algorithm can be implemented recursively as follows:

void print_descending (node* n) {

if (n->right) print_descending (n->right); // recursively output all values greater than or equal to n->data

printf ("%d\n", n->data); // output the data (assumes an integral type)

if (n->left) print_descending (n->left); // recursively output all values less than n->data

}

User Avatar

Wiki User

6y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which traversal of a binary search tree produces a descending sequence?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Which of the following traversal is used for printing the keys of binary search tree in ascending order?

In order traversal is used.


Is sorting a binary search tree simple?

A binary search tree is already ordered. An in order traversal will give you a sorted list of nodes.


C program which accepts in order and preorder traversal outputs of a binary tree as input and prints the corresponding binary tree?

any body can help on this ?


What is the definition of binary sequence?

A binary sequence is one in which only two different values are allowed. In computers, 1 and 0 are the conventional ones. So 10100110001 is a binary sequence. The sex of children born to a given set of parents could be b,g,g,b. This is a binary sequence. There is no conceptual limit to the length of a binary sequence.


What is 16 in binary sequence?

16 (decimal) = 10000 (binary).


How do you print all data in a Binary Search Tree?

By using Depth First Search or Breadth First search Tree traversal algorithm we can print data in Binary search tree.


Definition of threaded binary tree?

A binary tree variant that allows fast traversal: given a pointer to a node in a threaded tree, it is possible to cheaply find its in-order successor (and/or predecessor).


What is the binary sequence for 242?

11110010


Why is there no threading for post order traversal of a binary search tree?

You don't need it. Think about it, you can just use a stack (or a recursive function.)


What is the sum of the first 64 terms of the binary sequence?

A binary sequence is a sequence of [pseudo-]randomly generated binary digits. There is no definitive sum because the numbers are random. The sum could range from 0 to 64 with a mean sum of 32.


Algorithm to determine if a binary tree is complete binary?

There are many ways of checking for a complete binary tree. Here is one method:1. Do a level order traversal of the tree and store the data in an array2. If you encounter a nullnode, store a special flag value.3. Keep track of the last non-null node data stored in the array - lastvalue4. Now after the level order traversal, traverse this array up to the index lastvalue and check whether the flag value is encountered. If yes, then it is not a complete binary tree, otherwise it is a complete binary tree.


Binary numbers sequence from 1 to 1000?

1,10,11,100,101,110,111,1000