Professional Documents
Culture Documents
DSA Printout
DSA Printout
RECURSION
#include<iostream>
while ( s[i]!= ’ ‘ && i< s.length ()){ /*check ky s[i]!= ‘ ‘ jb tk ho ak word hn or length bi
string sy
word+=s[i];
i++;
st.push(word)
While(!st.empty(){})
int main(){
/*then we will pop each and every element then we will push it back into the sack to have the required
output go ahead huma*/
#include<stack>
// Stack S
stack<int> S;
int B_end = 0;
{
// If the stack is not empty ask its not empty programming maam
if (!S.empty())
{
{
B_end = B_end + 1;
S.pop();
// If the stack is empty We cannot
if (S.empty())
{
break;
}
top = S.top();
}
if (S.empty()) {
S.push(A[i]);
}
else
{
top = S.top();
// If the Current element of the array A[]
{
S.push(A[i]);
}
else
{
return false;
}
}
}
else
{
S.push(A[i]);
}
}
return true;
int main()
int A[] = { 4, 1, 2, 3 };
return 0;
Output:
YES