Skip to content

Conversation

sam28u
Copy link

@sam28u sam28u commented Oct 1, 2025

Add an algorithm (Morris Traversal for binary trees)

This PR adds the Morris Inorder Traversal algorithm.
Morris traversal allows in-order traversal of a binary tree without using recursion or a stack.
It uses threaded binary trees and runs in O(n) time with O(1) extra space.

Reference: Wikipedia – Tree traversal.

Checklist:
✅ I have read CONTRIBUTING.md.
✅ This pull request is all my own work -- I have not plagiarized.
✅ I know that pull requests will not be merged if they fail the automated tests.
✅ This PR only changes one algorithm file.
✅ The new file is placed in the correct directory (TreeTraversal/).
✅ The filename follows UpperCamelCase style: MorrisTraversal.js.
✅ I have added a Wikipedia (or equivalent) reference link in the comments.
✅ If this PR fixes an issue, my commit message contains Fixes:#1806.

@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.95%. Comparing base (08d8c6b) to head (bf0fe2e).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1812      +/-   ##
==========================================
+ Coverage   85.91%   85.95%   +0.03%     
==========================================
  Files         379      380       +1     
  Lines       19778    19831      +53     
  Branches     3015     3022       +7     
==========================================
+ Hits        16993    17046      +53     
  Misses       2785     2785              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants