chapter09 - Objectives Learn what a data structure is and...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Connecting with Computer Science 2 Objectives Learn what a data structure is and how it is used Learn about single and multidimensional arrays and how they work Learn what a pointer is and how it is used in data structures Learn that a linked list allows you to work with dynamic information
Background image of page 2
Connecting with Computer Science 3 Objectives (continued) Understand that a stack is a linked list and how it is used Learn that a queue is another form of a linked list and how it is used Learn that a binary tree is a data structure that stores information in a hierarchical order Be introduced to several sorting routines
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Connecting with Computer Science 4 Why You Need to Know About… Data Structures Data structures organize the data in a computer Efficiently access and process data All programs use some form of data structure Many occasions for using data structures
Background image of page 4
Connecting with Computer Science 5 Data Structures Data structure: way of organizing data Types of Data structures Arrays, lists, stacks, queues, trees for main memory Other file structures for secondary storage Computer’s memory is organized into cells Memory cell has a memory address and content Memory addresses organized consecutively Data structures hide physical implementation
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Connecting with Computer Science 6 Arrays Array Simplest memory data structure Consists of a set of contiguous memory cells Memory cells store homogeneous data Data stored may be sorted or left as entered Usefulness Student grades, book titles, college courses, etc. One variable name for large number of similar items
Background image of page 6
Connecting with Computer Science 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Connecting with Computer Science 8 How An Array Works Declaration (definition): provide data type and size Java example: int[ ] aGrades = new int[5]; “int[ ]” tells the computer array will hold integers “aGrades” is the name of the array “new” keyword specifies new array is being created “int[5]” reserves five memory locations “=” sign assigns aGrades as “manager” of the array “;” (semicolon) indicates end of statement reached Hungarian notation: standard used to name “aGrades”
Background image of page 8
Connecting with Computer Science 9
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Connecting with Computer Science 10 How An Array Works (continued) Dimensionality Dimensions: rows/columns of elements (memory cells) aGrades has one dimension (like a row of mailboxes) Manipulating one-dimensional arrays First address (position) is lower bound: zero (0) Next element offset by one from starting address Index (subscript): integer placed in “[ ]” for access Example: aGrades[0] = 50; Upper bound “off by one” from size: four (4)
Background image of page 10
Connecting with Computer Science 11
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Connecting with Computer Science 12
Background image of page 12
Connecting with Computer Science 13 Multidimensional Arrays Multidimensional arrays Consists of two or more single-dimensional arrays
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/08/2012 for the course SADSAD sdsadasdas taught by Professor Dasda during the Spring '11 term at Alaska Bible.

Page1 / 56

chapter09 - Objectives Learn what a data structure is and...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online