Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 11 Data Structures.

Similar presentations


Presentation on theme: "Chapter 11 Data Structures."— Presentation transcript:

1 Chapter 11 Data Structures

2 OBJECTIVES After reading this chapter, the reader should be able to:
Understand arrays and their usefulness. Understand records and the difference between an array and a record. Understand the concept of a linked list and the difference between an array and a linked list. Understand when to use an array and when to use a linked-list.

3 Data Structure Uses a collection of related variables that can be accessed individually or as whole. Represents a set of data items with specific relationship between them. Three types data structures : Arrays Records Linked lists

4 11.1 ARRAYS

5 array Is a fixed-size, sequenced collection of elements of the same data type. It is sequenced collection, so we identify the elements as first element, second element .. N element.

6 Twenty individual variables
Figure 11-1 Twenty individual variables

7 Processing individual variables
Figure 11-2 Processing individual variables

8 Arrays with subscripts and indexes
Figure 11-3 Arrays with subscripts and indexes

9 Figure 11-4 Processing an array

10 Array Applications Frequency array Graphical representation

11 Frequency array Show the number of elements with the same value found in a series of numbers

12 Figure 11-5 Frequency array

13 Histogram Pictorial representation of a frequency array
Printing the value of the elements to show the frequency of number in bar chart. Its called one-dimensional arrays because the data are organized linearly Two-dimensional array represent rows and column

14 Figure 11-6 Histogram

15 Two-dimensional array
Figure Part I Two-dimensional array

16 Figure 11-8 Memory layout

17 11.2 RECORDS

18 Records A collection of related elements, possibly of different types, having a single name Each element in a record is called a field A field : smallest elements of named data that has meaning Difference between array and records : all elements in array must be of the same type, elements in record can be the same or different types.

19 Figure 11-9 Records

20 Note: The elements in a record can be of the same or different types. But all elements in the record must be related.

21 11.3 LINKED LISTS

22 Linked list An ordered collection of data in which each element contains the location of the next elements Each elements contains two parts Data : holds the useful information, the data to be processed Link : to chain the data together

23 Figure 11-10 Linked lists

24 Figure 11-11 Node

25 Figure 11-12 Inserting a node

26 Figure 11-13 Deleting a node

27 Figure 11-14 Traversing a list


Download ppt "Chapter 11 Data Structures."

Similar presentations


Ads by Google