KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
What is the complexity of Go's builtin append function? What about string concatenation using + ? I'd like to remove an element from a slice by appending two slices excluding that element, ex. http://play.golang.org/p/RIR5fXq-Sf nums := []int{0, 1, 2, 3, 4, 5, 6, 7} fmt.Println(append(nums[:4], nums[5:]...)) => [0 1 2 3 5 6 7] http://golang.org/pkg/builtin/#append says that if the destination has sufficient capacity, then that slice is resliced . I'm hoping that "reslicing" is a constant time operation. I'm also hoping the same applies to string concatenation using + .
Tags (comma-separated)
Save Edits
Cancel