public int LeftShift(int index, bool removeTop) { MyStack stack = stacks[index]; int removed_item; removed_item = (removeTop) ? stack.Pop() : stack.RemoveBottom(); if (stack.IsEmpty()) { stacks.Remove(stacks[index]); } else if (stacks.Count > index + 1) { int item = LeftShift(index + 1, false); stack.Push(item); } return(removed_item); }
public bool IsEmpty() { MyStack last = GetLastStack(); return(last == null || last.IsEmpty()); }