Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

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

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M9592061

Have any Question?


Related Questions in Computer Engineering

While you were shopping at best buy you overhear a customer

While you were shopping at Best Buy, you overhear a customer asking one of the sales staff in the store about what is the fastest computer in the store that he can buy? The staff replies, "you're looking at our AMD machi ...

The american nursing association randomly selects 100 of

The American Nursing Association randomly selects 100 of its members from each state and invites them to participate in a survey about working conditions for hospital nurses in the United States. Which of the following i ...

What are impacts that flexible work schedules can have on a

What are impacts that flexible work schedules can have on a employee's productivity?

After reading the case presented in the module write a

After reading the case presented in the module, write a short response to the following discussion questions and ethical decision making scenario. Discussion Questions What project management tasks should Kelvin perform ...

Question 1in what ways can a hash value be secured so as to

Question: 1. In what ways can a hash value be secured so as to provide message authentication? 2. Elaborate on the applications, weaknesses and limitations of the hashing algorithms The response must be typed, single spa ...

Configuring name resolutionas the administrator of the

Configuring Name Resolution As the administrator of the Contoso Corporation, you manage an internal website that is often used by most users with the company. You try to connect to an internal website but cannot open the ...

Question suppose we have virtual memory containing 32 pages

Question : Suppose we have virtual memory containing 32 pages with 512 bytes per page and physical memory with 16 page frames. How long is a virtual address? How long is a physical address?

As a wealthy graduate of the university you have decided to

As a wealthy graduate of the University, you have decided to give back to the University in the form of a scholarship. You have decided to donate a one-time gift of $500,000 that will be invested at a rate of 5.5% per ye ...

Imagine you are employed by a large city police department

Imagine you are employed by a large city police department as the leader of the digital forensics division. A large corporation in the city has contacted the police for assistance in investigating its concerns that the c ...

Question for this assignment you will continue your

Question: For this Assignment, you will continue your practice as a critical consumer of research. You will critically evaluate a scholarly article related to one-way ANOVA testing. To prepare for this Assignment: • Use ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As