From cea4e9f166b7e8a8bf0cc40c6a24b2414ad34382 Mon Sep 17 00:00:00 2001 From: Robert Chisholm Date: Sat, 11 Jan 2025 18:11:22 +0000 Subject: [PATCH] Typo fix Attempt 2, fixed one issue left a second first attempt. --- episodes/optimisation-data-structures-algorithms.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/episodes/optimisation-data-structures-algorithms.md b/episodes/optimisation-data-structures-algorithms.md index 0c1c8d35..2d85c9b1 100644 --- a/episodes/optimisation-data-structures-algorithms.md +++ b/episodes/optimisation-data-structures-algorithms.md @@ -56,7 +56,7 @@ This is achieved by internally storing items in a static array. This array however can be longer than the list, so the current length of the list is stored alongside the array. When an item is appended, the list checks whether it has enough spare space to add the item to the end. If it doesn't, it will re-allocate a larger array, copy across the elements, and deallocate the old array. -The item to be appended is then copied to the end and the counter which tracks the list's length is increemnted. +The item to be appended is then copied to the end and the counter which tracks the list's length is incremented. The amount the internal array grows by is dependent on the particular list implementation's growth factor. CPython for example uses [`newsize + (newsize >> 3) + 6`](https://github.com/python/cpython/blob/a571a2fd3fdaeafdfd71f3d80ed5a3b22b63d0f7/Objects/listobject.c#L74), which works out to an over allocation of roughly ~12.5%.