1. Question 1 You are asked to design a data structure to store some objects. Each object has a 32-bit integer timestamp field. Your container is expected to be used like this: 1. Objects are inserted into the container, not necessarily ordered by the timestamp. It's guaranteed that there will never be more than 1,000,000,000 (1 billion) objects at once. 2. Objects will never be removed from the container. 3. Occasionally, you will need to iterate over all stored objects in a sorted by timestamp order. 4. The container is never shared among different threads. QUESTION Based on these requirements, which of the following designs would you consider acceptable with regards to worst-case scenario performance? You may select multiple options. OPTIONS • [ ] Store all objects in an array; append to the end; perform quicksort before we need to iterate if needed. • • [ ] Store all objects in an array; append to the end and perform in-place merge sort after each insertion if needed. [ ] Store all objects in an array; keep it sorted by inserting any new object at the appropriate position. ⚫ [ ] Use a balanced tree with dynamic node allocation, using timestamp field as the comparison criterion. • [ ] Keep a linked list of dynamically allocated elements and append to the end of it; perform merge sort before iterating if needed. • [ ] Store elements in a hashmap (mapping from timestamp to the object) with a reasonable number of buckets. ⚫ [ ] Preallocate an array and use timestamp as index in it. When we need to iterate, check all possible timestamps for associated objects.

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter3: Data Representation
Section: Chapter Questions
Problem 3RP
icon
Related questions
Question

CHATGPT GAVE ME WRONG ANSWER PLEASE HELP

1. Question 1
You are asked to design a data structure to store some objects. Each object has a 32-bit integer timestamp field. Your container is expected to be used like this:
1. Objects are inserted into the container, not necessarily ordered by the timestamp. It's guaranteed that there will never be more than 1,000,000,000 (1 billion) objects at once.
2. Objects will never be removed from the container.
3. Occasionally, you will need to iterate over all stored objects in a sorted by timestamp order.
4. The container is never shared among different threads.
QUESTION
Based on these requirements, which of the following designs would you consider acceptable with regards to worst-case scenario performance?
You may select multiple options.
OPTIONS
•
[ ] Store all objects in an array; append to the end; perform quicksort before we need to iterate if needed.
•
•
[ ] Store all objects in an array; append to the end and perform in-place merge sort after each insertion if needed.
[ ] Store all objects in an array; keep it sorted by inserting any new object at the appropriate position.
⚫ [ ] Use a balanced tree with dynamic node allocation, using timestamp field as the comparison criterion.
•
[ ] Keep a linked list of dynamically allocated elements and append to the end of it; perform merge sort before iterating if needed.
•
[ ] Store elements in a hashmap (mapping from timestamp to the object) with a reasonable number of buckets.
⚫ [ ] Preallocate an array and use timestamp as index in it. When we need to iterate, check all possible timestamps for associated objects.
Transcribed Image Text:1. Question 1 You are asked to design a data structure to store some objects. Each object has a 32-bit integer timestamp field. Your container is expected to be used like this: 1. Objects are inserted into the container, not necessarily ordered by the timestamp. It's guaranteed that there will never be more than 1,000,000,000 (1 billion) objects at once. 2. Objects will never be removed from the container. 3. Occasionally, you will need to iterate over all stored objects in a sorted by timestamp order. 4. The container is never shared among different threads. QUESTION Based on these requirements, which of the following designs would you consider acceptable with regards to worst-case scenario performance? You may select multiple options. OPTIONS • [ ] Store all objects in an array; append to the end; perform quicksort before we need to iterate if needed. • • [ ] Store all objects in an array; append to the end and perform in-place merge sort after each insertion if needed. [ ] Store all objects in an array; keep it sorted by inserting any new object at the appropriate position. ⚫ [ ] Use a balanced tree with dynamic node allocation, using timestamp field as the comparison criterion. • [ ] Keep a linked list of dynamically allocated elements and append to the end of it; perform merge sort before iterating if needed. • [ ] Store elements in a hashmap (mapping from timestamp to the object) with a reasonable number of buckets. ⚫ [ ] Preallocate an array and use timestamp as index in it. When we need to iterate, check all possible timestamps for associated objects.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
New Perspectives on HTML5, CSS3, and JavaScript
New Perspectives on HTML5, CSS3, and JavaScript
Computer Science
ISBN:
9781305503922
Author:
Patrick M. Carey
Publisher:
Cengage Learning
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr