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

Array implementation of a queue, Since the stack is list of elements, the q...

Since the stack is list of elements, the queue is also a list of elements. The stack & the queue differ just in the position where the elements may be added or deleted. Similar to

Binary tree and binarytree parts, Q. What do you understand by the term Bin...

Q. What do you understand by the term Binary Tree? What is the maximum number of nodes which are possible in a Binary Tree of depth d. Explain the terms given below with respect to

Need help with working out. I dont really get it, Suppose there are exactly...

Suppose there are exactly five packet switches (Figure 4) between a sending host and a receiving host connected by a virtual circuit line (shown as dotted line in figure 4). The tr

Calculate address of an element in an array., Q. Explain the technique to c...

Q. Explain the technique to calculate the address of an element in an array. A  25 × 4  matrix array DATA is stored in memory in 'row-major order'. If base  address is 200 and

The two famous methods for traversing, The two famous methods for traversin...

The two famous methods for traversing are:- a) Depth first traversal b) Breadth first

Grounded header link list and a circular header link list, What is the diff...

What is the difference between a grounded header link list and a circular header link list? A header linked list is a linked list which always having a special node, known as t

Basic organization of computer system, what happen''s in my computer when ...

what happen''s in my computer when i input any passage

Explain first - fit method, First - Fit Method: -    The free list is trave...

First - Fit Method: -    The free list is traversed sequentially to search the 1st free block whose size is larger than or equal to the amount requested. Once the block is found it

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