Data Structure Algorithm Interview Question for Automation Testers
Monday, January 25, 2016
Print Stack Value in reverse
public void stackReverse(DynamicArrayStack stack) throws Exception{
if(stack.isEmpty()){
return;
}
DynamicArrayStack s1 = new DynamicArrayStack(5);
while(!stack.isEmpty()){
int temp = stack.pop();
s1.push(temp);
}
System.out.println(s1);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment