SE250:lab-3:asin185

From Marks Wiki
Jump to navigation Jump to search

Lab 3

Intro

In this laba we implemented Array-based lists and did experiments to see differnces in its lenghts and capacity.

Task 1

#include <stdio.h>	
#include "arraylist.h" 

int main() {
    
    int time = clock();
    int i;
    ArrayList arr;
    arraylist_init(&arr);
    
    
    for(i = 0; i < 1000000; i++){ 
	arraylist_push(&arr,i);
    }
    time = clock() - time;
    printf("Time taken to insert n elements into the ArrayList time = %d", time);
    return 0;
}
Time taken to insert n elements into the ArrayList time = 47

Task 2