June 29, 2022 |10.4K Views

    Tree Sort

    Description
    Discussion

    Tree sort is a sorting algorithm that is based on Binary Search Tree data structure. It first creates a binary search tree from the elements of the input list or array and then performs an in-order traversal on the created binary search tree to get the elements in sorted order.

    Algorithm: 


    Step 1: Take the elements input in an array


    Step 2: Create a Binary search tree by inserting data items from the array into the binary search tree.


    Step 3: Perform in-order traversal on the tree to get the elements in sorted order.

    Applications of Tree sort:


    Its most common use is to edit the elements online: after each installation, a set of objects seen so far is available in a structured program.


    If you use a splay tree as a binary search tree, the resulting algorithm (called splaysort) has an additional property that it is an adaptive sort, which means its working time is faster than O (n log n) for virtual inputs.
     


    Tree Sort : https://www.geeksforgeeks.org/tree-sort/