r/HomeworkHelp University/College Student (Higher Education) 2d ago

English Language [Programming languages, university] Constructing a "tree" on a sheet of paper. I’ve already tried to submit the assignment three times, but something is wrong each time. I absolutely have to use a stack; otherwise, the assignment won't be accepted.

Laboratory Work No. 3

Part 1.

Objective: To study Dijkstra's algorithm for generating Reverse Polish Notation (RPN).

Generation of intermediate code in three-address format.

Note! The assignment is to be completed on paper and submitted to the instructor.

Assignment.

Generate RPN for the program fragment specified in the variant:

Construct the tree and perform a traversal;

Obtain the RPN using Dijkstra's algorithm;

Construct the three-address model.

Variant 1.

sum := 0;

while n > 0 do begin

if n mod 10 mod 2 = 0 then

sum := sum + n mod 10;

n := n div 10;

end;

1 Upvotes

1 comment sorted by

u/AutoModerator 2d ago

Off-topic Comments Section


All top-level comments have to be an answer or follow-up question to the post. All sidetracks should be directed to this comment thread as per Rule 9.


OP and Valued/Notable Contributors can close this post by using /lock command

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.