السلام عليكم
كيف ممكن نعمل برنامج لقراءة
postfix expression
باستخدام الاستاك
stack
ممكن تعطوني أفكاركم
السلام عليكم
كيف ممكن نعمل برنامج لقراءة
postfix expression
باستخدام الاستاك
stack
ممكن تعطوني أفكاركم
والله ناسي الصيغة تبعت البوست فيكس بس أظن أنك لازم تعمل مكدسين
ممكن تذكرني فيها إذا احتجت مساعدة إضافية
الله معك
شوف هذه الوصلة هتفيدك ان شاء الله
أشكركم كثيرا
هذه هي خوارزمية عمل البوستفيكس
1- Scan expression from left to right
2- When an operand is encountered, push it to the stack
3- When an operator is encountered, apply it to top two elements of the stack. Replace those element by the result of the operation (push the result).
4-When postfix expression has been exhausted, one element will remain on the stack. It is the result of the entire expression. Pop it as needed.
لكن ما زلت أجد صعوبة في ترجمتها إلى كود بالجافا
هذا الموضوع مغلق.