fix(#20): update img 4 and text for append

This commit is contained in:
AnruKitakaze 2025-07-16 00:36:17 +07:00
parent d21c8462b1
commit 42c11de062
2 changed files with 1 additions and 1 deletions

View file

@ -67,7 +67,7 @@ If we run this code, we see that the slice was able to cope with our request:
[0 1 0 2 3 4 5]
```
Because an array is a fixed-size structure, it can store the new elements until element 4. When we want to insert element 5, the array is already full: Go internally creates another array by doubling the capacity, copying all the elements, and then inserting element 5. Figure 4 shows this process.
Because an array is a fixed-size structure, we cannot fit all the new elements, since there isnt enough space for element 5. Go detects this in advance, creates another array with doubled capacity, copies the existing elements, and inserts all the new ones. Figure 4 illustrates this process.
<figure markdown>
![](img/slice-4.png)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB