Skip to content

Simulate recursion through Push (encapsulated call) and Pop(encapsulated call) to a stack and Execute non recursive part

Notifications You must be signed in to change notification settings

MarwanaMostafa/Simulate_Recursion

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Simulate_Recursion

Simulate recursion through Push (encapsulated call) and Pop(encapsulated call) to a stack and Execute non recursive part

How to Work :

1-Push an encapsulated call representing the whole subprogram to a stack.

2-Repeat the following: Pop an encapsulated call from the stack.

2.1-Execute the non-recursive parts.

2.2-If it contains a recursive call (directly or indirectly), do the following:

      - Divide the called subprogram into disjoint parts such that each part contains at most one recursive call,
        and each recursive call must be the last statement of one part.
      
      - Encapsulate each called subprogram part into an encapsulated call object.
      
      - Push all parts of the called subprogram to the stack in reverse order.

About

Simulate recursion through Push (encapsulated call) and Pop(encapsulated call) to a stack and Execute non recursive part

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages