Created
May 3, 2022 03:22
-
-
Save sausheong/0c96a03dfb49821a5a1570e2d3e33fde to your computer and use it in GitHub Desktop.
mst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Stack struct { | |
nodes [][2]*Node | |
} | |
func (s *Stack) Push(n [2]*Node) { | |
s.nodes = append(s.nodes, n) | |
} | |
func (s *Stack) Pop() (n [2]*Node) { | |
n = s.nodes[len(s.nodes)-1] | |
s.nodes = s.nodes[:len(s.nodes)-1] | |
return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment