O'Reilly logo

Absolute Beginner's Guide to Programming, Second Edition by Greg Perry

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Brief Introduction to Data Structures

A data structure is a collection of one or more variables taken as a group. Consider the storage of an inventory item. The computer needs to track the following values for each item:

  • Part Number

  • Quantity

  • Description

  • Cost

  • Retail Price

Of course, the company will have many items, so these values will be stored on the disk, probably read into five arrays, and managed from there.

Data Structures Help Group Data

The problem with using separate arrays is that your code must keep track of multiple arrays for the same inventory file. It's as though you must break the single inventory file into five pieces (the arrays) while your program works with the inventory, and then combine the five arrays into a single disk file ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required