lecture2a - Lecture2: ECE2574 DataStructures&Algorithms...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 2 : Abstract Data Types Part i. ECE 2574 Data Structures & Algorithms Chao Huang Virginia Tech Spring 2010
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
 C. Huang, Virginia Tech  ECE 2574 – Intro to Data Structures & Algorithms          Spring 2010 2 Writing  good  software is hard work One way to make the programmer's job easier is to use  Abstract Data Types (ADTs) An ADT can be packaged into a code  module  that other  programmers can use » collection of data » set of operations  that can be performed on that data As programs get large, it helps to subdivide them into modules,  especially true when a large group of people work on the same  program Abstract Data Types (ADTs)
Background image of page 2
 C. Huang, Virginia Tech  ECE 2574 – Intro to Data Structures & Algorithms          Spring 2010 3 Some Key Concepts ABSTRACTION » focus on   what  an object represents or does,  not   how   it does  it ENCAPSULATION » a technique that hides inner details MODULARITY » A module is a self-contained unit of code (separation of  concerns) » C++ classes facilitate all of these things
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
 C. Huang, Virginia Tech  ECE 2574 – Intro to Data Structures & Algorithms          Spring 2010 4 Example: Consider  lists   Here are some example lists: bread noodles cheese milk apples corn flakes flour a grocery list:
Background image of page 4
 C. Huang, Virginia Tech  ECE 2574 – Intro to Data Structures & Algorithms          Spring 2010 5 For the moment, forget about the C++ implementation details Think about the list at a high level of abstraction: bread noodles cheese milk apples corn flakes flour front (or head) of list end (or tail) of list Lists
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
 C. Huang, Virginia Tech  ECE 2574 – Intro to Data Structures & Algorithms          Spring 2010 6 A Sequence of “Items”  Let's decide that all items in the list must be of the same type Let's refer to each item's "position" in the list, with the first item  being at position 1  Let's refer to the number of items in the list as the "length" of  the list A list is called "linear" ( because it seems intuitive to place all  list items in a straight line) » Each item (except the first) has one  predecessor » Each item (except the last) has one  successor
Background image of page 6
 C. Huang, Virginia Tech  ECE 2574 – Intro to Data Structures & Algorithms          Spring 2010 7 bread noodles cheese milk apples corn flakes flour front (or head) of list end (or tail) of list position 1 2 3 4 5 6 7 The "length" of this list is 7 Now, without even considering software issues, think of  some  operations  that come to mind for lists A Sequence of “Items” (cont’d)
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
 C. Huang, Virginia Tech
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/28/2010 for the course ECE 2574 taught by Professor Chuang during the Spring '08 term at Virginia Tech.

Page1 / 39

lecture2a - Lecture2: ECE2574 DataStructures&Algorithms...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online