Skip to content
Open
Show file tree
Hide file tree
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
22 changes: 11 additions & 11 deletions pretext/AlgorithmAnalysis/HashTableAnalysis.ptx
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ for i in range(10000,1000001,20000):
</code></program></statement>
</task>
</exploration>
<p><xref ref="fig-vectvshash-cpp"/> summarizes the results of running
<p><xref ref="fig-vectvshash2-cpp"/> summarizes the results of running
<xref ref="expl-hashtable-analysis"/>. You can see that the hash table is consistently
faster. For the smallest vector size of 10,000 elements a hash table is
89.4 times faster than a vector. For the largest vector size of 990,000
Expand All @@ -186,16 +186,16 @@ for i in range(10000,1000001,20000):
contains operation took 0.004 milliseconds and for the hash table size
of 990,000 it also took 0.004 milliseconds.</p>

<figure xml:id="fig-vectvshash-cpp">
<caption>Comparing the <c>contains</c> operation for C++ vectors and Hash Tables</caption>
<image source="AlgorithmAnalysis/vectvshash.png" width="90%">
<description><p>The primary take away is that the graph for vectors shows an almost linear climb from
0 elements taking almost 0 time to 1,000,000 elements taking approximately 45 seconds. For hash
tables, the function is also linear, but shows almost 0 slope from 0 elements to 1,000,000 elements
in the hash table. This reflects the linear versus constant time growth of the two
functions.</p></description>
</image>
</figure>
<figure xml:id="fig-vectvshash2-cpp">
<caption>Comparing the <c>contains</c> operation for C++ vectors and Hash Tables</caption>
<image source="AlgorithmAnalysis/vectvshash2.png" width="90%">
<description><p>The primary take away is that the graph for vectors shows an almost linear climb from
0 elements taking almost 0 time to 1,000,000 elements taking approximately 69 microseconds. For hash
tables, the function is also linear, but shows almost 0 slope from 0 elements to 1,000,000 elements
in the hash table, staying at approximately 2 to 3 nanoseconds throughout. This reflects the linear
versus constant time growth of the two functions.</p></description>
</image>
</figure>

<p>Since C++ is an evolving language, there are always changes going on
behind the scenes. The latest information on the performance of C++
Expand Down
Binary file added pretext/Figures/AlgorithmAnalysis/vectvshash2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.