Data structures are primarily used in the organization and storage of data in a manner that it ensures that the can be retrieved and used efficiently. Data may be organized either in a linear or non-linear fashion depending on the underlying complexity and cases of interrelationships. The linear approach arranges data elements one after the other (Valiente, 2003). Non-linear data structures on the other hand are established through connecting a data element to other diverse data elements in a manner that serves to depict a given relationship between them. It is vital to note that non-linear data structures are represented in a manner that is not similar to data arrangements in the memory of the computer. The area of focus of the presented situation warrants the use of a non-linear data structure, where the contents of the data are not arranged in a sequential manner and that data retrieval in this way cannot be retrieved using a single run. Some of the common non-linear data structures include multi-dimensional arrays, trees and graphs. This paper aims at determining the most appropriate data structure for mapping the routes and a corresponding justification. The paper also evaluates the possibility of a change of the data structure in the expansion of the routes.
Mapping the routes requires the plot to fly from Airport A then to Airport B, from Airport B then to Airport C. Sometimes, the pilot flies from Airport C to either D or E. An analysis of these routes reveals that there are distinct connections and relationships between the routes that the pilot flies, which warrants the use of the tree type structure when mapping the routes. It is also evident that there are no self loops and circuits when mapping the routes that the pilot constantly flies, which further justifies the use of tree type data structure to map the routes. The tree type data structure is also recommended due to the fact that there are numerous rules that dictate how the connection can occur when mapping the routes. For instance, the pilot can only get to airport C after passing through Airport A and then Airport B. Additionally; the pilot cannot get to Airport D or Airport E without passing through Airport C. These sets of rules make the use of the tree type structure the most appropriate for mapping the routes (Spinrad, 2003). With these regard, the following tree can be used to map the routes that the pilot constantly flies. It is notable from the tree that retrieval cannot be done by a single run, rather can be traced back sequentially basing on the rules connecting the various points (Valiente, 2003).
In case, the routes are expanded in such a manner that the pilot flies from Airport A to Airport B, Airport B to Airport C, and sometimes from Airport C to Airport D to Airport F or Airport G then back to Airport A and other flights from Airport C to Airport E then to Airport A. In addition, there are three different flight paths from Airport B to Airport C. In this case, the most appropriate data structure choice is the use of graphs. It is arguably evident that there are cyclic loops and that there are no specific rules that determine the paths to be taken and how the nodes are to be connected (Spinrad, 2003). A mapping of the routes also reveals that there are disjointed routes from supplementary sets of nodes and that the pilot can retrieve the original point using a single run due to various loops and alternative paths at his disposal. This makes the use of the graphs data structure the most adaptable when the routes are expanded. The graph used to map the routes is shown in the figure below.
Spinrad, J. (2003). Efficient graph representations. Washington DC: American Mathematical Soc.
Valiente, G. (2003). Algorithms on trees and graphs. New York: Springer.