lecture2a - Lecture2: ECE2574 DataStructures&Algorithms...

Info icon This 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
Image of page 1

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

View Full Document Right 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)
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
Image of page 3

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

View Full Document Right 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:
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
Image of page 5

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

View Full Document Right 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
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)
Image of page 7

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern