/* stack reversal in place. */ stack_rev(stack * s) { if(IsEmpty(s) ) return; top = pop(s); stack_rev(s) just_fly_and_back(s, top) }
/* unwind the stack till end, put the backup , rewind it back */ just_fly_and_back(stack *s, int prev_top) { if (isEmpty(s)) { push(s, prev_top) return; } b = pop(s); just_fly_and_back(s, prev_top); push(s, b) }