Abstract

This paper presents a new, linear algorithm for performing the roll operation on binary trees. Based on the inorder tree traversal, this algorithm has a very simple structure and achieves linear time and space complexity. A detailed analysis of this algorithm is presented, showing how its design contributes to a more streamlined operation and an improved time complexity over the original — and only other known to the authors — binary tree roll algorithm. A practical implementation of both algorithms is benchmarked by counting the minimum and maximum numbers of basic operations, as well as measuring the minimum and maximum amounts of memory space required by the algorithms to run to completion, across all binary tree topologies with progressively increasing numbers of nodes. Results obtained from this empirical analysis quantify the best-and worst-case complexities of both algorithms and show how the improved algorithm outperforms the original one asymptotically, particularly in regards to their time complexity.

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.