CS240 - 91 Data Structures - PowerPoint PPT Presentation

1 / 16
About This Presentation
Title:

CS240 - 91 Data Structures

Description:

Understand the fundamental ways of organizing collections ... multimap. stack. queue. string. bitset. istream. ostream. iostream. ifstream. ofstream. fstream ... – PowerPoint PPT presentation

Number of Views:65
Avg rating:3.0/5.0
Slides: 17
Provided by: wat88
Category:

less

Transcript and Presenter's Notes

Title: CS240 - 91 Data Structures


1
CS240 - 91 Data Structures
  • Spring 2006

2
Some Course Goals
  • Understand the fundamental ways of organizing
    collections of data to be processed by a program
  • focus is on main-memory data structures
  • Be able to evaluate the efficiency of data
    structures and their algorithms
  • memory space needed to store the data
  • efficiency of algorithms to manipulate the data
  • Be able to define, implement and use Abstract
    Data Types (ADTs)
  • Learn to use libraries of data structures
    provided by HLLs (STL, Java Collection classes)

3
Prerequisites
  • CS-140 Intro to Computer Programming
  • given a problem specification design, code,
    test, and document a program which meets that
    specification
  • Programming language constructs
  • primitive data types, arithmetic and relational
    operators, arrays, conditional and iterative
    structures, functions (methods), arguments and
    parameters and return values, I/O

4
Language Used in CS240
  • This is a course in Data Structures!
  • principles are language independent
  • We will be using C
  • Platforms
  • Lab Linux or Cygwin
  • Home Linux, Knoppix, Cygwin
  • programs submitted must compile using the GNU
    compiler

5
ANSI C Compilers
  • GNU compiler
  • open source software from the Free Software
    Foundation
  • www.gnu.org
  • available on Bingsuns
  • built-in on most Linux systems
  • Cygwin is a Unix-like environment (including the
    GNU compiler) for Windows (sources.redhat.com/cygw
    in/)
  • Microsoft Visual C
  • integrated editor, compiler, linker, project
    manager (IDE)
  • version 6.0 is on all Computer Center PCs and in
    Watson Microlab
  • free to students in Watson courses through the
    Microsoft Academic Alliance
  • www.cplusplus.com/info/compilers/

6
Course Material
  • Syllabus and other course information available
    at
  • dforeman.cs.binghamton.edu/foreman
  • Makefiles. See
  • www.gnu.org/manual/make-3.80/make.html

7
Data Algorithms Programs
  • Every program processes some data
  • Data has to be stored in memory at run-time
  • Java, C, C are strongly typed languages
  • all data items have a type associated with them
  • Data to be processed is stored by declaring data
    objects (variables)
  • type name
  • type name value
  • Type of a data object determines
  • what can be done (operations)
  • how the data is represented in memory

8
Types
  • Pre-defined (built-in) types
  • scalar (atomic) types store a single value
  • structured types store a collection of values
  • Most languages have libraries of types
  • STL of C
  • Java library
  • Programmer-defined types
  • create new types appropriate for the problem
    being solved
  • built from pre-defined types

9
Java's Data Types
  • Primitive types
  • byte, short, int, long, float, double, char,
    boolean
  • are built-in and scalar
  • variable name is directly associated with the
    memory location of the value
  • Class types
  • value is a reference to (memory address of) an
    object
  • the object is instantiated using new
  • variable name is indirectly associated with the
    memory location of an object

10
C Types
Structured Types
Scalar Types
array struct union class
Arithmetic
void
pointer
bool
complex
Integral
Floating point
(reals)
float double long double
Characters
Integers
Enumerations
int short int long int unsigned short
unsigned long unsigned
char unsigned char signed char
11
Abstract Data Type
  • Consists of
  • a collection of data items
  • operations that can be performed on the
    collection
  • Is independent of programming language
  • Has
  • Definition of data and operations (what)
  • Implementation how data is stored and
    algorithms to carry out the operations
  • User uses the ADT to solve a problem doesn't
    need to know the implementation details

12
Built-in Types as ADTs
  • Definition of the ADT integer
  • Data items
  • an integer value in the set ,-3, -2, -1, 0, 1,
    2, 3,
  • Maximum and minimum values are determined by the
    storage representation used
  • Operations
  • Binary arithmetic operations , -, , /,
  • Unary arithmetic operations , -
  • Relational operations , !, lt, lt, gt, gt

13
Implementation
  • How is an integer value stored?
  • Number of bytes of memory?
  • How is the value represented as a sequence of
    bits?
  • sign-magnitude
  • 2's complement
  • biased notation
  • Algorithms to carry out the operations
  • Depend on choice of representation
  • Make use of machine architecture

14
Use
  • Principle of data abstraction definition of a
    data type separate from implementation.
  • User of an ADT does not need to know the
    implementation of the ADT.
  • User needs to know the syntax and behavior of the
    ADT's operations.
  • Implementation of an ADT does affect the
    efficiency of an ADT's operations.

15
Help with C
  • www.cplusplus.com/doc/tutorial/
  • sections 1 and 2

16
Some Comparisons
  • Java syntax comes from C (and C)
  • control structures (if, if-else, do while, for,
    switch, ..)
  • primitive types (int, float, double, char, ..)
  • Java (almost) pure OO
  • C a hybrid of OO and procedural
  • has "free" functions (independent of a class)
  • Java is compiled to byte code which is executed
    by a Java interpreter (JVM)
  • C is compiled to object code from which a
    machine executable file is created
Write a Comment
User Comments (0)
About PowerShow.com