Sie sind auf Seite 1von 2

Chapter 1 Introduction

1.1.1. Introduction to Data Structures and Algorithms


1.1.1.1. Introduction
Primary purpose of computer science: to store and retrieve information, usually as fast as possible
Data Structures and Algorithm course will teach 3 things:
1. Presents a collection of commonly used data structures and algorithms ("toolkit") that will help provide a
good solution for many problems. We focus on ones that have proven most useful over time.
2. Introduces idea of tradeoffs (costs and benefits) for every data structure or algorithm.
a. Amount of time and space required for typical operations
b. Time required for key input types
3. Teaches how to measure effectiveness of a data structure or algorithm.
a. Techniques allow you to judge merit of new data structures
Computer Design Goals
1. To design an algorithm that is easy to understand, code, and debug.
2. To design an algorithm that makes efficient use of the computers resources.
a. We mostly will focus on these goals in this CS 3114
Measuring Efficiency
Asymptotic Analysis: method for evaluating the efficiency of an algorithm or computer program.
o Gives a way to define difficulty of a problem
o Use asymptotic analysis techniques to estimate time cost for every algorithm in text
1.1.1.2. A Philosophy of Data Structures
Data Structure: any data representation and its associated operations.
Ex. Integer or floating data point store on computer (simple data structure)
Ideas further explored in Abstract Data Types discussion
Data Item: a piece of information or a record whose value is drawn from a type.
Always possible to search for specified items within a collection, print or process data items in any
desired order, or modify the value of any item.
o Proper data structure necessary for fast and efficient programs
Ex. Searching a hash table faster than searching an unsorted array
What is an Efficient Solution?
One that solves the problem within the required resource constraints
o Resource constraint examples: total storage space; time
Requires less resource = more efficient
Cost of a Solution

Amount of resources the solution consumes


Usually, cost measured in terms of 1 key resource, with implied assumption that solution meets all the
resource constraints

1.1.1.3 Selecting a Data Structure


Selecting a Data Structure Procedure
1. Analyze problem to determine basic operations that must be supported.
a. Ex. Inserting, deleting, and finding a data item
2. Quantify the resource constraints for each operation.
3. Select the data structure that best meets these requirements.
This 3-step process operationalizes a data-centered view of the design process.
Concerns
Data and operations to be performed on them
Representation for those data
Implementation of that representation
Questions to Ask When Choosing a Data Structure
1. Are all data items inserted into data structure at beginning or interspersed with other operations?
a. Static applications (data stored in beginning and never change) typically get by with simpler data
structures to get an efficient implementation.
b. Dynamic applications often require more complicated data structures.
2. Can data items be deleted?
a. More complicated implementation if delete is required
3. Are all data items processed in some well-defined order, or is search for specific data items allowed?
a. Random access search search generally requires more complex data structures.
Summary
Data structure requires
o A certain amount of space for each data item stored
o A certain amount of time to perform a single basic operation
o A certain amount of programming effort
Each problem has constraints on available space and time
Each solution makes use of basic operations in some relative proportion, and data selection process
must account for this

Das könnte Ihnen auch gefallen