Question: A. Describe the advantages and disadvantages of using an Array based data structure. (5pts) B. Describe the advantages and disadvantages of using a Linked

A. Describe the advantages and disadvantages of using an Array based data

A. Describe the advantages and disadvantages of using an Array based data structure. (5pts) B. Describe the advantages and disadvantages of using a Linked List based data structure. (5pts) C. Given the code snippet below, if we assume that the linked list currently has the values , then what will be printed to the console after the method "printAllValues" is called? If there are errors in the method "printAllValues", then instead describe the errors and how they can be fixed so the method does print all values. (5pts) private class ListNode private double data; private ListNode link; public ListNode(double aData, ListNode aLink) data aData; link alink; private ListNode head; public void printAllValues() ( ListNode temp head; while(temp.link != null) { System.out.println(temp.data); D. Describe the difference between a Queue and a Stack. (5pts) E. Assume we both enqueue and push the values in order into both a queue and a stack respectively. Then we dequeue and pop 5 times. Then we enqueue and push the values . Finally, we dequeue and pop 2 more times. What values are contained in resulting queue? What values are contained in the resulting the stack? Clearly indicate the head (first value) of each of the structures, and if it is the queue or the stack.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!