3. Definition
• DataStructureisaway of collecting and organizing data
in such away that wecan perform operationson these
datain an effectiveway. DataStructuresisabout
rendering dataelementsin termsof somerelationship, for
better organization and storage.
• Datastructurescan implement oneor moreparticular
abstract datatypes(ADT), which arethemeansof
specifying thecontract of operationsand their complexity
.
Data Structures - Introduction 3
4. Picking thebest
DataStructurefor thejob
• Thedatastructureyou pick needsto suppo rt the
operationsyou need
• Ideally it supportstheoperationsyou will usemost
often in an efficient manner
• Examplesof operations:
– A List with operationsinsert and delete
– A Stack with operationspushand pop
4
Basic Terminologies & Asymptotic
Notations
5. Terminology
• Abstract DataType(ADT)
– Mathematical description of an object with set of
operationson theobject. Useful building block.
• Algorithm
– A high level, languageindependent, description of
astep-by-step process
• Datastructure
– A specific family of algorithmsfor implementing
an abstract datatype.
• Implementation of datastructure
– A specific implementation in aspecific language
5
Basic Terminologies & Asymptotic
Notations
6. Terminology
• Data
Datarefersto valueor set of values.
e.g.Marksobtained by thestudents.
• Datatype
datatypeisaclassification identifying oneof varioustypes
of data, such as floating-point, integer, or Boolean, that
determinesthepossiblevaluesfor that type; theoperations
that can bedoneon valuesof that type; and theway values
of that typecan bestored
Data Structures - Introduction 6
7. Terminology
• Primitivedatatype:
Thesearebasic datatypesthat areprovided by the
programming languagewith built-in support. Thesedata
typesare nativeto thelanguage. Thisdatatypeis
supported by machinedirectly
• Variable
Variableisasymbolic namegiven to someknown or
unknown quantity or information, for thepurposeof
allowing thenameto beused independently of the
information it represents.
Data Structures - Introduction 7
8. Terminology
• Record
Collection of related dataitemsisknown asrecord. The
elementsof recordsareusually Called fieldsor members.
Recordsare distinguished from arraysby thefact that
their number of fieldsistypically fixed, each field hasa
name, and that each field may haveadifferent type.
• Program
A sequenceof instructionsthat acomputer can
interpret and execute.
Data Structures - Introduction 8
9. Terminology examples
• A stack isan abstract data type supporting push, pop and
isEmpty operations
• A stack data structure could usean array, alinked list, or
anything that can hold data
• Onestack implementatio n isjava.util.Stack; another is
java.util.LinkedList
9
Basic Terminologies & Asymptotic
Notations
10. Concepts vs. Mechanisms
• Abstract
• Pseudocode
• Algorithm
– A sequenceof high-level,
languageindependent
operations, which may act
upon an abstracted view
of data.
• Abstract DataType(ADT)
– A mathematical
description of an object
and theset of operations
on theobject.
• Concrete
• Specific programming language
• Program
– A sequenceof operationsin a
specific programming language,
which may act upon real datain
theform of numbers, images,
sound, etc.
• Datastructure
– A specific way in which a
program’sdataisrepresented,
which reflectsthe
programmer’sdesign
choices/goals.
10
11. Why So Many DataStructures?
Ideal datastructure:
“fast”, “elegant”, memory efficient
Generatestensions:
– timevs. space
– performancevs. elegance
– generality vs. simplicity
– oneoperation’sperformancevs. another’s
The study o f data structures is the study
o f tradeo ffs. That’ s why we have so
many o f them!
11Basic Terminologies & Asymptotic
Notations
Editor's Notes
clever – range from techniques with which you are already familiar – eg, representing simple lists – to ones that are more complex, such as hash tables or self-balancing trees. Elegant, mathematically deep, non obvious.
making the different meanings of “efficient” precise is much of the work of this course!
Note how much messier life becomes when we move from abstract concepts to concrete mechanisms. Being able to abstract the intrinsic problems from the real world scenarios -- or, alternatively, being able to realize an abstract concept in code -- is one of the important skills that computer scientists need to possess.
Note that pseudocode is a concept, and a programming language is a mechanism.
What does it mean to be “fast”? What about “elegant”?