This question already has an answer here:
- Big O of append in Golang 1 answer
Java's ArrayList
add method runs in amortized constant time. Same for vector's push_back in C++.
So does append()
in Go also run on amortized constant time?
</div>
This question already has an answer here:
Java's ArrayList
add method runs in amortized constant time. Same for vector's push_back in C++.
So does append()
in Go also run on amortized constant time?
</div>
see https://blog.golang.org/slices
The answer should be 'yes' as you expect