Linked List Variations, Data Structure & Algorithms

Assignment Help:
Part1: Deque and Bag Implementation

First, complete the Linked List Implementation of the Deque (as in Worksheet 19) and Bag ADTs (Worksheet 22).
Files Needed:

linkedList.c
LinkedList.h
linkedListMain.c
testLinkedList.c
makefile
Part 2: Comparison

The files linkedListMain.c and dynamicArrayMain.c contain code which does the following:

Runs an outer loop from 1000 up to 200000, doubling the loop variable,n, at each iteration
In each iteration, it performs n calls to add() followed by n calls to contains()
Prints the time taken by these contains() calls in milliseconds
Your job is to compare the memory requirements and execution time performance of the LinkedList to the Dynamic Array.

Time Comparison

To gather timing and memory usage, you will execute the dynamicArrayMain() program using a tool called valgrind .

To execute valgrind from the command line on flip, simply type:

valgrind --tool=massif [executable]
replacing [executable] with the name of the executable (if you''re using our makeifle, that name is ''prog''). This will result in two outputs. First, the amount of time elapsed for each iteration (in ms) will be printed to the shell. You must copy these times so you can plot them in a tool such as Microsoft Excel.

Memory Comparison

Second, valgrind will produce a file named massif.out.[number]. You will then execute the following at the command line:

ms_print massif.out.[number] > memDump
replacing [number] with the number in the file that valgrind produced. This command (piped to a file!!) will create a file called memDump which looks like THIS

In memDump, find the line that says "Detailed Snapshots: [ 3, 8 ...] ". This set of numbers corresponds to line numbers in the table below it where you will find the amount of memory sampled at each snapShot, in the column labeled total(B). You are to take those memory snapshots and create a graph (in excel, for example), of the memory profile for your execution.

You will repeat this process for the LinkedListMain so that you can compare it to the Dynamic Array

Note that the dynamic array must have a capacity of 1000 to start with. The policy is to double the size when the array is full. We''re providing the dynamic array implementation below.

Answer the following questions:

Which of the implementations uses more memory? Explain why.
Which of the implementations is the fastest? Explain why.
Would you expect anything to change if the loop performed remove() instead of contains()? If so, what? (Note, it''s very easy to run this experiment given the code we''ve provided!)
IMPORTANT NOTES:

# You must run all memory usage and timing tests on flip.

Files needed:

dynamicArray.h
dynamicArray.c
dynamicArrayMain.c
makefile
Part3: Implementation of the Deque ADT Using a Circularly Linked List

For this problem, you will implement the Deque ADT with a Circularly-Doubly-Linked List with a Sentinel. As you know, the sentinel is a special link, does not contain a value, and should not be removed. Using a sentinel makes some linked list operations easier and cleaner in implementation. This list is circular, meaning the end points back to the beginning, thus one sentinel suffices. The header file and the implementation file for this approach are cirListDeque.h and cirListDeque.c, respectively. Complete the functions in cirListDeque.c and write a test harness in listDequeTest.c to test the functionality of your Circularly-Doubly-Linked List.

Notes: The reverse() function should reverse the ordering "in place", meaning it should not allocate any new memory or create a new cirListDeque. Instead, reverse the ordering of the existing DLink elements.

Files needed

cirListDeque.h
cirListDeque.c
testCirListDeque.c
makefile

Related Discussions:- Linked List Variations

Data mining assignment, The assignment aims at consolidating your knowledge...

The assignment aims at consolidating your knowledge on data mining techniques and developing practical skills through solving a problem of transcription factor binding sites recogn

R. Studio, I need a person who has a good background in using R. Studio? I...

I need a person who has a good background in using R. Studio? In adition, a person who is good in using algorithms.

Explain the interfaces in ruby, Explain the Interfaces in Ruby Recall...

Explain the Interfaces in Ruby Recall that in object-oriented programming, an interface is a collection of abstract operations that cannot be instantiated. Even though Ruby i

Example of pre order traversal, Example of pre order traversal: Reading of...

Example of pre order traversal: Reading of a book, since we do not read next chapter unless we complete all sections of previous chapter & all its sections. Figure  : Rea

Create accessors for this data structure, Create a Money data structure tha...

Create a Money data structure that is made up of amount and currency. (a) Write a constructor for this data structure (b) Create accessors for this data structure (c) Writ

Explain the method of overlapping and intersecting, Overlapping or Interse...

Overlapping or Intersecting A polygon overlaps or intersects the current background if any of its sides cuts the edges of the viewport as depicted at the top right corner of th

Comp. sci algorithms, 1. develop an algorithm which reads two decimal numbe...

1. develop an algorithm which reads two decimal numbers x and y and determines and prints out wether x>y or y>x. the input values, x and y, are whole number > or equal to 0, which

Define a tree and list its properties, QUESTION (a) Define a tree and l...

QUESTION (a) Define a tree and list its properties. (b) By showing all your workings, draw the spanning tree for the following graph based on the Breadth-First-Search algori

Programme in c to create a single linked list, Q. Write  down a   p...

Q. Write  down a   programme  in  C  to  create  a  single  linked  list also  write the functions to do the following operations (i)  To insert a new node at the end (ii

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd