Question: Question 1 Data structure can be defined as the way of organizing all data items that consider not only the elements stored but also stores

Question 1

Data structure can be defined as the way of organizing all data items that consider not only the elements stored but also stores the relationship between the elements.

(a) Identify ONE (1) real-life scenario that can better be modeled with a queue rather than a stack. Explain why a queue is better than a stack in this case.

(b) Compare and contrast array implementation and linked list implementation of a simple list.

(c) List down FIVE (5) basic operations of data structure.

(d) Choose one object. Identify FOUR (4) data that describe the object. Then write C++ code to define a structure (struct) for the object.

(e) Assume that we are using the usual node definition (with structure tag called node and data member called data and link to the next node called link) to create a list of integer number. Assume further the linked list hold by two pointers called first and last.

i. Show the C++ code to declare the two pointers, first and last.

ii. Write the C++ code to display the content of the linked list.

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 Databases Questions!