(Migrated to personal blog: link) In Go, append(slice, x) is one of the most used built-in functions. But have you ever thought about a simple question: what is the time complexity of it? The short answer: The amortized cost of append() is O(1), but the worst-case cost is O(N). Before…