CEG's Linux User Group

  • Increase font size
  • Default font size
  • Decrease font size
Home Labs Reversing a binary search tree using stack

Reversing a binary search tree using stack

E-mail Print
User Rating: / 4
PoorBest 
Article Index
Reversing a binary search tree using stack
Source code
Documentation
Test cases and compatibility
All Pages

REVERSING A BINARY SEARCH TREE USING STACK


Introduction:

In computer science, a binary search tree (BST) is a binary tree data structure

The major advantage of binary search trees over other data structures is that the related sorting algorithms and search algorithms such as in-order traversal can be very efficient.

One such application of the binary search tree is that it can be used for arranging a given string in sorted alphabetical order. In this characters are arranged as per the structure property of binary tree using the ASCII value of the characters in the string. In this program the characters are obtained from the user and it is inserted into the binary search tree. after this the tree is reversed using a stack by pushing the elements and then popping them from the stack.

 

The node of a tree contains:

binarytree1



Last Updated on Saturday, 13 June 2009 18:02  
Please register or login to add your comments to this article.