Docsity

Data Structures: Learning to Organize and Implement Efficiently, Slides of Data Structures and Algorithms

Partial preview of the text

Download Data Structures: Learning to Organize and Implement Efficiently and more Slides Data Structures and Algorithms in PDF only on Docsity!

AL 1

Data Structures

AL 2

Data Structures

 Prepares the students for (and is a prerequisite for) the more advanced material students will encounter in later courses.

 Cover well-known data structures such as dynamic arrays, linked lists, stacks, queues, tree and graphs.

 Implement data structures in C++

AL 4

Data Structures

 Prepares the students for (and is a prerequisite for) the more advanced material students will encounter in later courses.

 Cover well-known data structures such as dynamic arrays, linked lists, stacks, queues, tree and graphs.

 Implement data structures in C++

AL 7

Need for Data Structures

 Data structures organize data ⇒ more efficient programs.

 More powerful computers ⇒ more complex applications.

 More complex applications demand more calculations.

AL 9

Need for Data Structures

 Data structures organize data ⇒ more efficient programs.

 More powerful computers ⇒ more complex applications.

 More complex applications demand more calculations.

AL 10

Organizing Data

 Any organization for a collection of records that can be searched, processed in any order, or modified.

 The choice of data structure and algorithm can make the difference between a program running in a few seconds or many days.

AL 12

Efficiency

 A solution is said to be efficient if it solves the problem within its resource constraints.

  • Space
  • Time

 The cost of a solution is the amount of resources that the solution consumes.

AL 13

Efficiency

 A solution is said to be efficient if it solves the problem within its resource constraints.

  • Space
  • Time

 The cost of a solution is the amount of resources that the solution consumes.

AL 15

Selecting a Data Structure

Select a data structure as follows:

  1. Analyze the problem to determine the resource constraints a solution must meet.
  2. Determine the basic operations that must be supported. Quantify the resource constraints for each operation.
  3. Select the data structure that best meets these requirements.

AL 16

Selecting a Data Structure

Select a data structure as follows:

  1. Analyze the problem to determine the resource constraints a solution must meet.
  2. Determine the basic operations that must be supported. Quantify the resource constraints for each operation.
  3. Select the data structure that best meets these requirements.

AL 18

Some Questions to Ask

  • Are all data inserted into the data structure at the beginning, or are insertions interspersed with other operations?
  • Can data be deleted?
  • Are all data processed in some well- defined order, or is random access allowed?

AL 19

Some Questions to Ask

  • Are all data inserted into the data structure at the beginning, or are insertions interspersed with other operations?
  • Can data be deleted?
  • Are all data processed in some well- defined order, or is random access allowed?

AL 21

Data Structure Philosophy

 Each data structure has costs and benefits.

 Rarely is one data structure better than another in all situations.

 A data structure requires:

  • space for each data item it stores,
  • time to perform each basic operation,
  • programming effort.

AL 22

Data Structure Philosophy

 Each data structure has costs and benefits.

 Rarely is one data structure better than another in all situations.

 A data structure requires:

  • space for each data item it stores,
  • time to perform each basic operation,
  • programming effort.