(i int, j int)
| 17 | } |
| 18 | |
| 19 | func (s *Stack) Swap(i int, j int) bool { |
| 20 | if i > s.Size()-1 || i < 0 { |
| 21 | return false |
| 22 | } |
| 23 | if j > s.Size()-1 || j < 0 { |
| 24 | return false |
| 25 | } |
| 26 | s.array[i], s.array[j] = s.array[j], s.array[i] |
| 27 | |
| 28 | return true |
| 29 | |
| 30 | } |
| 31 | func (s *Stack) Pop() interface{} { |
| 32 | stackLen := len(s.array) |
| 33 | if stackLen == 0 { |