Question: Create a recursive algorithm that takes two sorted stacks as parameters (max value at the top), and counts the number of the same elements between
Create a recursive algorithm that takes two sorted stacks as parameters (max value at the top), and counts the number of the same elements between the two. For example S1 {2, 3, 4, 5} and S2 {4, 5, 6, 9, 10, 15} should return 2 as both stacks contain 4 and 5.
The stacks remain unaffected after the program is run (i.e they are returned to their original state).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
