Implementing Linear Data Structures
________ is a data structure to store data in sequential order. A. A List B. A Set C. A Stack D. A Queue
A. A List
As implemented in our textbook: Suppose list1 is a MyArrayList and list2 is a MyLinkedList. Both contains 1 million double values. Analyze the following code: // A: while (list1.size() > 0) list1.remove(0); // B: while (list2.size() > 0) list2.remove(0); A. Code fragment A runs faster than code fragment B. B. Code fragment B runs faster than code fragment A. C. Code fragments A and B should run at about the same speed (based on Big-O analysis). D. Both contain logic errors because they produce infinite loops.
B. Code fragment B runs faster than code fragment A.
As implemented in our textbook: MyLinkedList is more efficient than MyArrayList for the following operations: A. Insert/delete an element in the middle of the list. B. Insert/delete an element in the beginning of the list C. Append an element at the end of the list. D. Retrieve an element at given the index.
B. Insert/delete an element in the beginning of the list
Which data structure is appropriate to store patients seeking COVID-19 Vaccine shots in California in the first quarter of 2021? NOTE: For those that forgot, due to limited availability, healthy people were supposed to wait until those with "underlying medical conditions" got their vaccinations first. Oh... and of course Federal politicians get theirs before everyone! And if you are really paying attention, similar "availability protocols" and in place for Monkey-pox vaccinations. A. Stack B. Queue C. Any List (Array or Link based) D. A Queue implemented as a Heap
D. A Queue implemented as a Heap
As implemented in our textbook: MyArrayList is more efficient than MyLinkedList for the following operations: A. Insert/delete an element in the middle of the list. B. Insert/delete an element in the beginning of the list. C. Append an element at the end of the list. D. Retrieve an element at given the index.
D. Retrieve an element at given the index.