Document “ Data structure modeling ”.
The objective of this activity is to introduce you in the data modeling of a software application, so that you can extend the knowledge about which data you should model, how to model it, the different options for real implementation of a data model, implications for writing program code, the importance of the layer separation, etc. In this way, you can try to generalize some concepts in order to be able to apply them for different specific applications, and particularly to apply them for the proposed project application, that you must do in groups.
In the previous activities of this sesion, you must do the following:
Read the material about data modeling and decissions of data structures in an application.
For the application example of the resource you should have read (this application example has some analogies with the project that the groups must do), complete the following tasks:
Define the data structures that are needed to store the information about the photos and authors using static memory with a fixed array of N elements for the photos and of M elements for the authors. How would you select the number N? Would you be always using the least amount of possible memory for the storage? What will be the maximum number of photos that you could have?
Define the data structures that are needed to store the information about the photos in dynamic memory (all continous), and also the authors in other dynamic memory portion (all continous). You must not allocate more memory than necessary in any case. This is, you must not allocate memory for elements that are not going to be stored yet.
Define the data structures that are needed to store the information about the photos in a linked list, and about the authors in another linked list.
Define the data structures that are needed to store the information of all the photos in different linked lists, using a hash function to decide in which one of the linked list, the photo should be stored. You must also do it for the authors in an analogous way.
For each one of the previous defined data structures, implement a function that will be able to initialize such data structures, representing that there is no element in that moment
For each one of the previous defined data structures, implement a function that will be able to add a new photo to the collection. You can assume that there is not previously in the collection the specific photo that is going to be added. It must work both: for the case when there are not any photos in the collection, or when there are already some elements in the data structure.
Check with these questions if you understood the document on data struture modeling
In an application, there is data about hotel companies, as well as their respective hotels. Each hotel can only belong to a hotel company. If in the design phase, we identify a table for the hotel companies, and another table for the hotels. Which will be the relationship between both tables?
Suppose that you need to use dynamic memory for storing several hotels that are registered in the application in a moment. In addition, you need to make quick searches of such hotels taking into account some of their information fields in order to select hotels according to certain restrictions. This number of hotels for searching can be from 1 to more than 1 million. The structure that suits better to store the information is:
Consider that all the information about hotels and hotel companies must be stored in a file. If later we want to make frequently searching operations of hotels given a specific city where the hotel is located. For doing this type of operation, the better option is to store the information in a file that:
In a textual mode application, if we want to transform it in order to add a graphical interface for such application. The extension will be easier if: