<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-3%3Arthu009</id>
	<title>SE250:lab-3:rthu009 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kram.nz/index.php?action=history&amp;feed=atom&amp;title=SE250%3Alab-3%3Arthu009"/>
	<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-3:rthu009&amp;action=history"/>
	<updated>2026-04-22T06:12:47Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.3</generator>
	<entry>
		<id>https://wiki.kram.nz/index.php?title=SE250:lab-3:rthu009&amp;diff=5721&amp;oldid=prev</id>
		<title>Mark: 11 revision(s)</title>
		<link rel="alternate" type="text/html" href="https://wiki.kram.nz/index.php?title=SE250:lab-3:rthu009&amp;diff=5721&amp;oldid=prev"/>
		<updated>2008-11-03T05:19:26Z</updated>

		<summary type="html">&lt;p&gt;11 revision(s)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Lab 3 Rthu009 ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task 1 ==&lt;br /&gt;
&lt;br /&gt;
In this task it required for me to push the array list by adding numbers to the arraylist_push function. I have set up loops which increment the value one by one and then adding it to the array push list. &lt;br /&gt;
&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 #include &amp;quot;arraylist.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
 #include &amp;lt;time.h&amp;gt;&lt;br /&gt;
 .&lt;br /&gt;
 int main (){&lt;br /&gt;
 .	int i;&lt;br /&gt;
 .	clock_t start, finish;&lt;br /&gt;
 .   double  duration;&lt;br /&gt;
 .	ArrayList arr;&lt;br /&gt;
 .	arraylist_init( &amp;amp;arr );&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 .	start = clock();&lt;br /&gt;
 .	for( i=0; i &amp;lt;= 100000000; i++ ){&lt;br /&gt;
 .		arraylist_push(&amp;amp;arr, i );&lt;br /&gt;
 .&lt;br /&gt;
 .	}&lt;br /&gt;
 finish = clock();&lt;br /&gt;
 .&lt;br /&gt;
 .&lt;br /&gt;
 duration = (double)(finish - start) / CLOCKS_PER_SEC;&lt;br /&gt;
 .  &lt;br /&gt;
 .  printf(&amp;quot;Time takes to push 100000000 numbers\n&amp;quot;);&lt;br /&gt;
 .  printf( &amp;quot;%2.1f seconds\n&amp;quot;, duration );&lt;br /&gt;
 . &lt;br /&gt;
 .&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As a result of adding 100000000 numbers to the array_push list it has taken 15.1 seconds to complete the task. &lt;br /&gt;
I have tried to increase the values to  1000000000 and the program ran our of memory and program aborted. This can be because the malloc function couldn’t generate any more space for that required for the program to execute.&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;Output&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Time takes to push 100000000 numbers&lt;br /&gt;
&lt;br /&gt;
15.1 seconds&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Task 2 ==&lt;br /&gt;
&lt;br /&gt;
In this task the growth factor has been increases by multiples of 2.  The result shows the how increasing growth can have a significant effect on the time. &lt;br /&gt;
&lt;br /&gt;
 Growth factor 	Time taken&lt;br /&gt;
 2	          9.6&lt;br /&gt;
 4	          9.9&lt;br /&gt;
 6	          8.9&lt;br /&gt;
 8	          9.1&lt;br /&gt;
 10	          8.5&lt;br /&gt;
 12	          --&lt;br /&gt;
 14	          8.4&lt;br /&gt;
 16	          9.2&lt;br /&gt;
 18	          --&lt;br /&gt;
 20	          --&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The dash lines shows the area where the program crashed trying to allocate more memory space.&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
== Task 3 ==&lt;br /&gt;
&lt;br /&gt;
results of increasing the array size&lt;br /&gt;
&lt;br /&gt;
 Array size	Time (s)&lt;br /&gt;
     16	          9.1&lt;br /&gt;
     17	          9.6&lt;br /&gt;
     18	          9.4&lt;br /&gt;
     19	          9.8&lt;br /&gt;
     20	          9.9&lt;br /&gt;
     25	          8.9&lt;br /&gt;
     30	          9.6&lt;br /&gt;
     40	          9.6&lt;br /&gt;
     41            9.9&lt;br /&gt;
&lt;br /&gt;
There isn&amp;#039;t any significant change in the time there for the i assume the increasing array size around this range wouldn&amp;#039;t make much different.&lt;/div&gt;</summary>
		<author><name>Mark</name></author>
	</entry>
</feed>