Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions pretext/CollectionData/Vectors.ptx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<section xml:id="collection-data_vectors">
<title>Vectors</title>
<p><term>Vectors</term> are much more similar to Python lists than arrays are.
<introduction>
<p><term>Vectors</term> are much more similar to Python lists than arrays are.
Vectors use a dynamically allocated array to store their elements,
so they can change size, and they have other friendly features as well.
Because they use a dynamically allocated array, they use contiguous storage locations
Expand Down Expand Up @@ -141,7 +142,8 @@
as we see in the next example.
Because vectors can change size, vectors typically allocate some extra storage to accommodate for possible growth.
Thus the vector typically has an actual <term>capacity</term> greater than the storage <term>size</term> strictly needed to contain its elements.</p>
<subsection xml:id="collection-data_iterating-through-vectors">
</introduction>
<subsection xml:id="collection-data_iterating-through-vectors">
<title>Iterating through Vectors</title>
<p>When iterating vectors, you must first find the length of your container. You can simply call the <c>.length()</c> function.
For arrays, the number of elements can be found by getting the size in memory of the array
Expand Down Expand Up @@ -433,5 +435,4 @@ main()
</exercise>
</reading-questions>
</subsection>
</section>

</section>