Professional Documents
Culture Documents
1
(Equal Stacks)
Step:-1. Firstly, create a three stack and we have also created a three variable which store the sum of the all
the three individual stack.
Step:-2. Find the length of all the three stacks
Step:- 3. Make a loop for all the individual stack and sum all the elements of an stack and push the elements of
a particular stack.
Step:-4. while any of the stack will not empty - pop out an element from the stack have maximum height.
Step:-5. Then return if all the stack have same height or say sum of remaining element in each array will not
become equal.
Step:-6. If I don't use stack here we can make index element for each array and maintain height.
4. Steps for experiment/practical/Code:
int equalStacks(
(vector<int> h1, vector<int> h2,
vector<int> h3)
{
int sum1 = 0;
int sum2 = 0; int
sum3 = 0;
stack<int> st1;
stack<int> st2; stack<int
int>
st3;
2.
3.