C-Plus-Plus
C-Plus-Plus copied to clipboard
feat: add morris in order traversal
Description of Change
Morris Inorder Traversal is a way to perform an in-order traversal of a binary tree without using recursion or a stack, by creating temporary threads to predecessors. It modifies the tree during the traversal but restores it afterward, achieving O(1) extra space complexity.
Checklist
- [x] Added description of change
- [x] Added file name matches File name guidelines
- [x] Added tests and example, test must pass
- [x] Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
- [x] Relevant documentation/comments is changed or added
- [x] PR title follows semantic commit guidelines
- [x] Search previous suggestions before making a new one, as yours may be a duplicate.
- [x] I acknowledge that all my contributions will be made under the project's license.
Notes: