Skip to content

feat: add infix to postfix, prefix, and prefix to infix expression converters #2960

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Sreekar-Reddy-D
Copy link

Description

Added three expression conversion algorithms:

  • infix_to_postfix.cpp
  • infix_to_prefix.cpp
  • prefix_to_infix.cpp

Each file:

  • Uses assert-based unit testing
  • Fully documented with Doxygen comments
  • Placed in strings/ folder per CONTRIBUTING.md

Checklist

  • Code compiles and runs
  • test() function included
  • Matches CMU and repo style guidelines

Copy link
Collaborator

@realstealthninja realstealthninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open seperate prs or merge all the functions to one class

@Sreekar-Reddy-D
Copy link
Author

->Merged all conversion functions (infix_to_postfix, infix_to_prefix, prefix_to_infix) into a unified expression namespace
->Removed unnecessary class wrapper for simplicity
->Added detailed Doxygen-style comments and modular helper functions (is_operator, precedence, etc.)
->Improved readability and maintainability without changing existing logic
->All test cases pass successfully

@Sreekar-Reddy-D
Copy link
Author

As per your suggestion to either open separate PRs or merge all conversion functions into a single class, I have chosen the latter approach.

I have merged all the conversion functions (infix_to_postfix, infix_to_prefix, prefix_to_infix) into a unified expression namespace.

The previous class wrapper was removed to simplify the structure and improve clarity.

I also added modular helper functions such as is_operator and precedence, along with Doxygen-style documentation for better maintainability and readability.

All existing logic remains unchanged, and I have verified that all test cases pass successfully.

Please let me know if any further changes are needed.

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