Skip to main content Accessibility help
×
Hostname: page-component-76fb5796d-qxdb6 Total loading time: 0 Render date: 2024-04-26T19:21:28.864Z Has data issue: false hasContentIssue false

Seven - OO Data Structures

Published online by Cambridge University Press:  15 October 2009

Ed Akin
Affiliation:
Rice University, Houston
Get access

Summary

Data Structures

We have seen that F90 has a very strong intrinsic base for supporting the use of subscripted arrays. Fortran arrays can contain intrinsic data types as well as user-defined types (i.e., ADTs). One cannot directly have an array of pointers, but an array containing defined types that are pointers or that have components that are pointers is allowable. Arrays offer an efficient way to contain information and to insert and extract information. However, there are many times when creating an efficient algorithm dictates that we use some specialized storage method, or container, and a set of operations to act with that storage mode. The storage representation and the set of operations that are allowed for it are known as a data structure. How you store and retrieve an item from a container is often independent of the nature of the item itself. Thus, different instances of a data structure may produce containers for different types of objects. Data structures have the potential for a large amount of code reuse, which is a basic goal of OOP methods. In the following sections we will consider some of the more commonly used containers. We will begin with stacks and queues, which are illustrated in Figure 7.1.

Stacks

A stack is a data structure in which access is restricted to the last inserted object. It is referred to as a last-in first-out (LIFO) container. In other words, a stack is a container to which elements may only be inserted or removed at one end of the container called the top of the stack.

Type
Chapter
Information
Publisher: Cambridge University Press
Print publication year: 2003

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

Save book to Kindle

To save this book to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

  • OO Data Structures
  • Ed Akin, Rice University, Houston
  • Book: Object-Oriented Programming via Fortran 90/95
  • Online publication: 15 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511530111.008
Available formats
×

Save book to Dropbox

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Dropbox.

  • OO Data Structures
  • Ed Akin, Rice University, Houston
  • Book: Object-Oriented Programming via Fortran 90/95
  • Online publication: 15 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511530111.008
Available formats
×

Save book to Google Drive

To save content items to your account, please confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your account. Find out more about saving content to Google Drive.

  • OO Data Structures
  • Ed Akin, Rice University, Houston
  • Book: Object-Oriented Programming via Fortran 90/95
  • Online publication: 15 October 2009
  • Chapter DOI: https://doi.org/10.1017/CBO9780511530111.008
Available formats
×