Preliminaries Attendance sheets –I remembered! Survey links –HW1 time survey –Anonymous feedback survey HW discussion (4PM, Commons 9)

Slides:



Advertisements
Similar presentations
Lists in Lisp and Scheme a. Lists are Lisp’s fundamental data structures, but there are others – Arrays, characters, strings, etc. – Common Lisp has moved.
Advertisements

COMPSCI 105 S Principles of Computer Science 12 Abstract Data Type.
Preliminaries Attendance sheets –I remembered! HW1 due tonight –progress report Stage 1 due on Friday –progress report.
A list = a Linear Recursive Structure (LRS or LRStruct) What is a list? 1.the empty list is a list 2.a pair whose tail is a list is itself a list This.
Preliminaries Stage 1 due tonight by 9:00 PM HW1 discussion (4PM, Commons 9) –may try for next week? HW2 available later today, due Monday by 9:00 PM.
No homework this week Stage 2 starts next week. Code review Team with N members is assigned N submissions to review Discuss submissions within team Everyone.
Data Structures Hash Tables
Dictionaries and Their Implementations
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Lists We’ve seen an array-based list implementation, the ArrayList. Advantage of an array-based implementation: –fast access to a specific index –typically.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Chair of Software Engineering OOSC - Lecture 4 1 Object-Oriented Software Construction Bertrand Meyer.
Lists We’ve seen an array-based list implementation, the ArrayList.
©Silberschatz, Korth and Sudarshan12.1Database System Concepts Chapter 12: Part B Part A:  Index Definition in SQL  Ordered Indices  Index Sequential.
1 Data Structures Data Structures Topic #2. 2 Today’s Agenda Data Abstraction –Given what we talked about last time, we need to step through an example.
Data Structures Topic #3. Today’s Agenda Ordered List ADTs –What are they –Discuss two different interpretations of an “ordered list” –Are manipulated.
CHAPTER 11 Searching. 2 Introduction Searching is the process of finding a target element among a group of items (the search pool), or determining that.
© 2006 Pearson Addison-Wesley. All rights reserved4-1 Chapter 4 Data Abstraction: The Walls.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 19 Binary.
Chapter 24 Dispensers and dictionaries. This chapter discusses n Dictionaries n Dispensers u stacks u queues u priority queues.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
CS 206 Introduction to Computer Science II 09 / 30 / 2009 Instructor: Michael Eckmann.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 4: Linked Lists Data Abstraction & Problem Solving with.
Data Abstraction CS 201j: Engineering Software University of Virginia Computer Science Nathanael Paul
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Architecture styles Pipes and filters Object-oriented design Implicit invocation Layering Repositories.
Lecture 10 Trees –Definiton of trees –Uses of trees –Operations on a tree.
Recursion: Linear and Tree Recursive Processes and Iteration CMSC Introduction to Computer Programming October 7, 2002.
CS212: DATA STRUCTURES Lecture 1: Introduction. What is this course is about ?  Data structures : conceptual and concrete ways to organize data for efficient.
Week 3 – Wednesday.  What did we talk about last time?  ADTs  List implementation with a dynamic array.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 10Slide 1 Architectural Design l Establishing the overall structure of a software system.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IX Interpreter, Mediator, Template Method recap.
CSE 143 Lecture 6 Linked Lists slides created by Ethan Apter
Chapter 8 Object Design Reuse and Patterns. Object Design Object design is the process of adding details to the requirements analysis and making implementation.
Hashing Sections 10.2 – 10.3 CS 302 Dr. George Bebis.
Object Oriented Software Development
Telecooperation/RBG Technische Universität Darmstadt Copyrighted material; for TUD student use only Introduction to Computer Science I Topic 8: Accumulating.
Dynamic Array. An Array-Based Implementation - Summary Good things:  Fast, random access of elements  Very memory efficient, very little memory is required.
CS535 Programming Languages Chapter - 10 Functional Programming With Lists.
SOFTWARE DESIGN AND ARCHITECTURE LECTURE 13. Review Shared Data Software Architectures – Black board Style architecture.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
(c) University of Washington16-1 CSC 143 Java Lists via Links Reading: Ch. 23.
Sets of Digital Data CSCI 2720 Fall 2005 Kraemer.
Testing OO software. State Based Testing State machine: implementation-independent specification (model) of the dynamic behaviour of the system State:
1 Multi-Level Indexing and B-Trees. 2 Statement of the Problem When indexes grow too large they have to be stored on secondary storage. However, there.
Lecture - 10 on Data Structures. 6:05:57 PM Prepared by, Jesmin Akhter, Lecturer, IIT,JU.
Linked List Containers. Linked Lists List consists of multiple listnodes List consists of multiple listnodes Each listnode consists of Each listnode consists.
Review of Parnas’ Criteria for Decomposing Systems into Modules Zheng Wang, Yuan Zhang Michigan State University 04/19/2002.
Linked List Containers. Linked Lists List consists of multiple listnodes List consists of multiple listnodes Each listnode consists of Each listnode consists.
Patterns for Decoupling Data Structures and Algorithms or How visitors can help you grow! Stephen Wong, Oberlin College Dung “Zung” Nguyen, Pepperdine.
CS 206 Introduction to Computer Science II 02 / 02 / 2009 Instructor: Michael Eckmann.
Patterns for Decoupling Data Structures and Algorithms Dung “Zung” Nguyen Pepperdine University / University of Houston Stephen Wong Oberlin College
1ADS Lecture 11 Stacks contd.. ADS Lecture 113 Singly Linked list-based Stack Top of stack is head of list (can insert elements at head in constant.
Data Structures Doubly and Circular Lists Lecture 07: Linked Lists
BINARY TREES Objectives Define trees as data structures Define the terms associated with trees Discuss tree traversal algorithms Discuss a binary.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
Unit 1 - Introducing Abstract Data Type (ADT) Part 3 – Slides 1 to 11.
CompSci 280 S Introduction to Software Development
Sorted Linked List Same objective as a linked list, but it should be sorted Sorting can be custom according to the type of nodes Offers speedups over non-sorted.
Data Structure Interview Question and Answers
Chapter 25: Advanced Data Types and New Applications
Lists in Lisp and Scheme
Dictionaries and Their Implementations
Ch. 8 Priority Queues And Heaps
Advanced Implementation of Tables
Hashing Sections 10.2 – 10.3 Lecture 26 CS302 Data Structures
CSC 143 Java Linked Lists.
Lecture-Hashing.
Lecture 3 – Data collection List ADT
Presentation transcript:

Preliminaries Attendance sheets –I remembered! Survey links –HW1 time survey –Anonymous feedback survey HW discussion (4PM, Commons 9)

Today Linked list advantages/disadvantages Software design issues –In context of list definition Recursion –In context of list definition

Array-based list Advantage of an array-based implementation: –fast access to a specific index –typically less space usage than other options Disadvantage of an array-based implementation: –can be expensive to insert items –resizing is an expensive operation

Linked list Advantages –predictable cost of insertion –efficient insertion at any point in structure Disadvantages –extra space required to store links –inefficient indexing

Comparison of storage A pair has a first and a second element When pairs are used to construct lists, the first is called the “head” or the “car” the second is called the “tail”, “rest” or “cdr” the pair is called a “cons cell” or simply a “cons”.

Linked list implementations Textbook discusses a typical linked list implementation java.util.LinkedList is another typical implementation These implementations have procedural, not object-oriented, roots.

ListNodes Clients interact with List object

Traditional implementations provide a large number of methods – making it difficult to reuse if less functionality is desired; provide no means, beyond inheritance, to extend functionality to suit a specific situation; and adding functionality requires knowledge of internal structure of the list.

So… These implementations are inflexible, and do not exhibit good OO design. In lecture we will discuss a state-based list implementation which can be easily extended with new functionality.

Variant/Invariant decomposition Design principle which leads to cohesive and decoupled components That which is invariant is put into one component Variant properties/behaviors are factored out into separate components Compare this to what we saw with e.g. Observer pattern: –decoupling of event generation (invariant) from event handling (variant)

a list = a Linear Recursive Structure (LRS or LRStruct) What is a list? 1.the empty list is a list 2.a pair whose tail is a list is itself a list This is a recursive definition! (1) is called the base case, and (2) is called the recursive case. Note that traditional implementations do not follow this precise definition of what a list is: –many have no explicit representation of an empty list –none are recursive on the list; instead they recurse on a list node This has implications for how the structure can support extension (see Visitor support, in later slides)

States A list can therefore be in one of two states: –empty (corresponding to the base case) –non-empty (corresponding to the recursive case) The state-based implementation we will study makes this distinction explicit in the representation

LRStruct design