data structures fall 2013. what is a data structure? a data structure is a method of organizing...

10
Data Structures Fall 2013

Upload: violet-small

Post on 05-Jan-2016

215 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

Data Structures

Fall

2013

Page 2: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

What is a Data Structure?

• A data structure is a method of organizing data.

• The study of data structures is particularly important when using an object-oriented programming language.

Page 3: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

Simple Data Types

• Many programming languages provide built-in simple data types. For example:– Characters– Integers– Real Numbers– Boolean (TRUE, FALSE)– Strings (words)

Page 4: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

Arrays

• A one-dimensional array can be thought of as a list or a vector. It is a homogeneous collection of data.

• For example, an array of 10 integers might take 20 bytes of storage. If the name of the array is IntArray, the 10 integers might be accessed as IntArray[0], IntArray[1], ... , IntArray[9].

Page 5: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

Arrays II

• Most programming languages provide built-in arrays.

• Most programming languages provide for multi-dimensional arrays.

• A two-dimensional array, for example, allows the programmer to think of the data as being organized in a table (rows and columns). Note this is a virtual table.

Page 6: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

Records

• A record is a heterogeneous data structure.

• For example, a student record, or a customer record.

• The individual components of a record are called fields.

Page 7: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

Abstract Data Type

• An ADT is a data structure together with the operations that are allowed on the data structure.

• STACK: FILO structure, top, Push, Pop

• QUEUE: FIFO structure, head, tail (front, back), Enqueue, Dequeue

• LIST: head, tail, current, Insert, Delete, Next

Page 8: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

Pointers• A pointer is a structure that contains not

data but an address that points to data.

• The Program Counter can be considered as a pointer.

• Pointers allow for dynamic memory allocation.

• Many data structures can be implemented either with dynamic or static memory allocation.

Page 9: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

Other Structures

• Trees: Family tree, Directory, Binary Tree, Game Tree

• Graphs: A general graph is a mathematical structure that consists of a set of vertices and a set of edges. The study of graph theory is very important in theoretical Computer Science.

Page 10: Data Structures Fall 2013. What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important

To study for the Quiz

What is an Abstract Data Type?

Be able to describe the following ADT’s by their actions and how they can be implemented:

Stack, Queue, Binary Tree, Graph

Distinction between dynamic and static.