Lecture Notes for SE 598, Data Structures and Algorithms
24 May 2000, Introduction to C++
- programming languages are useful because they, among other things,
provide some handy, pre-defined data structures
- but how can you have data structures without knowing what the data
structures are modeling
- most worlds are sufficiently similar in their basic characteristics
that it makes sense to pre-define some proven data structures
- it's a bit like off-the-rack clothing - everybody's different in detail
but generally the same in structure
- generic programming is an extension of this idea
- try to develop sophisticated, pre-defined data structures
- the standard template library supports generic programming
- c++ data structures
- what are types
- a type is the way characteristics determine values
- data type is another name for data structure
- "what is this value's type" rather than "what is this
value's structure" - equivalent questions
- simple data structures
- the basic (or elemental) data types - bits, bytes, words
- the atomic data types - ints, floats, doubles, chars, and bools
- arrays - a non-atomic, or composite, or structured data structure
- a homogeneous collection of data - all of the same type
- each datum is called an element, or a member, or an item
- any element in the array can be accessed with the same amount of work
- all elements in an array are accessible
- any element is equally easy to access as any other
- indices identify one element from another
- structures
- a heterogeneous collection of data - different types
- accessed via the dot operator
- unions - the structure's evil sibling
- how does programming get done
- data structures and algorithms - which comes first
- procedural programming - concentrate on algorithms and the data
structures follow
- identify the important transformations required
- implement each transformation as a procedure
- derive the data structures based on the given data and the procedures
- object-oriented programming - concentrate on data structures and the
algorithms follow
- identify the important entities in the world
- implement each entity as an object
- derive the interactions among objects
This page last modified on 24 May 2000.