Abstract Data Types (ADTs)

Slides:



Advertisements
Similar presentations
Computer Science 112 Fundamentals of Programming II Overview of Collections.
Advertisements

CS 307 Fundamentals of Computer Science 1 Abstract Data Types many slides taken from Mike Scott, UT Austin.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
CS Winter 2011 Abstract Data Types. Container Classes Over the years, programmers have identified a small number of different ways of organizing.
Chapter 24 Dispensers and dictionaries. This chapter discusses n Dictionaries n Dispensers u stacks u queues u priority queues.
Data Structures 1- Course Syllabus. 2- Introduction about Data Structures.
Lists, Stacks, Queues Svetlin Nakov Telerik Corporation
Chapter 3 List Stacks and Queues. Data Structures Data structure is a representation of data and the operations allowed on that data. Data structure is.
Data Structures and Abstract Data Types "Get your data structures correct first, and the rest of the program will write itself." - David Jones.
TECH Computer Science Data Abstraction and Basic Data Structures Improving efficiency by building better  Data Structure Object IN  Abstract Data Type.
Jan 12, 2012 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
Information and Computer Sciences University of Hawaii, Manoa
Data structures Abstract data types Java classes for Data structures and ADTs.
CS261 – Data Structures Iterator ADT Dynamic Array and Linked List.
Foundation of Computing Systems Lecture 3 Stacks and Queues.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
Introduction to the Standard Template Library (STL) A container class holds a number of similar objects. Examples: –Vector –List –Stack –Queue –Set –Map.
Data Structures Chapter 6. Data Structure A data structure is a representation of data and the operations allowed on that data. Examples: 1.Array 2.Record.
Data Structures for Midterm 2. C++ Data Structure Runtimes.
Abstract Data Type EnhanceEdu.
Algorithms and Data Structures Lecture VI
CPS120: Introduction to Computer Science Nell Dale John Lewis Abstract Data Types.
Abstract Data Types and Stacks CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington Last updated: 2/17/
1 CS162: Introduction to Computer Science II Abstract Data Types.
Code: BCA302 Data Structures with C Prof.(Dr.) Monalisa Banerjee By.
UNIT-V ABSTRACT DATA TYPE 1.LIST 2.STACK 3.QUEUE EC6301-II-ECE-C.
Chapter 3 Lists, Stacks, Queues. Abstract Data Types A set of items – Just items, not data types, nothing related to programming code A set of operations.
Stacks and Queues. DCS – SWC 2 Stacks A stack is an abstract data structure, with some special properties: –Insertion and deletion is only allowed at.
Using the Java Collection Libraries COMP 103 # T2
Data Structures Interview Questions.
G64ADS Advanced Data Structures
Set Collection A Bag is a general collection class that implements the Collection interface. A Set is a collection that resembles a Bag with the provision.
Stacks The content for these slides was originally created by Gerard Harrison. Ported to C# by Mike Panitz.
Fundamentals of Programming II Overview of Collections
CSCI 104 Abstract Data Types
Heaps And Priority Queues
Abstraction A tool (concept) to manage complexity
Priority Queues and Heaps
Cinda Heeren / Geoffrey Tien
STACKS AND QUEUES UNIT 2 DS THROUGH C++.
Stacks and Queues.
Array Array is a variable which holds multiple values (elements) of similar data types. All the values are having their own index with an array. Index.
Data Structures and Database Applications Abstract Data Types
Introduction to Data Structure
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Road Map CS Concepts Data Structures Java Language Java Collections
structures and their relationships." - Linus Torvalds
Abstract Data Types (ADTs)
Stack ADT & Modularity 2 implementations of the Stack abstract data type: Array Linked List Program design: modularity, abstraction and information hiding.
structures and their relationships." - Linus Torvalds
- Alan Perlis Topic 24 Heaps "You think you know when you can learn,
Stacks and Queues.
Introduction to Data Structures
Lesson 6. Types Equality and Identity. Collections.
ITEC 2620M Introduction to Data Structures
Introduction to Computer Science for Majors II
Abstract Data Type Abstract Data Type as a design tool
Introduction to Data Structure
Abstract Data Types, Elementary Data Structures and Arrays
Abstract Data Type (ADT)
Priority Queues & Heaps
(1 - 2) Introduction to C Data Structures & Abstract Data Types
CS 240 – Advanced Programming Concepts
Dynamic Array: Implementation of Stack
structures and their relationships." - Linus Torvalds
Abstract Data Types Stacks CSCI 240
A type is a collection of values
Data Structures & Programming
Presentation transcript:

Abstract Data Types (ADTs) CS 261 – Data Structures Abstract Data Types (ADTs)

Container Classes Over the years, programmers have identified a small number of different ways of organizing collections of data These container abstractions are now the fundamental heart of the study of data structures Examples: bag, stack, queue, set, map, etc.

Three Levels of Abstraction There are at least three levels of abstraction in the study of data structures: ADT: Abstract Data Type, language independent Interface: the interface in a particular library of containers Implementation: the various implementations in a particular library

ADT (Abstract Data Type) View Every data type can be described in a way that is independent of language/library Example: a Stack is a collection that has the property that an item removed is the most recently entered item Properties that are true regardless of the names given to operations in library An Abstract Data Type is: A behavior-level description of the operations on and properties of some data/values

Metaphors ADT view are often described by metaphors: Example: stack of plates Easy to remember Easy to understand

The Interface View Gives specific names and parameters to operations: struct Stack; void initStack(struct Stack *stk); void pushStack(struct Stack *stk, double val); double topStack(struct Stack *stk); void popStack(struct Stack *stk); int isEmptyStack(struct Stack *stk); In C, interface view is defined by .h file(s)

Interface View: Additional Information The interface view gives only signatures (i.e., declarations) Must also attach meanings (LIFO properties of stack, etc.) Can also attach expected execution times (want push and pop to be constant time)

Implementation View Fill in the (language specific) details: void pushStack(struct Stack *stk, double val) { stk->data.add(val); } int stackIsEmpty(struct Stack *stk) { return vectorSize(stk->data) == 0: In C, implementation view is defined by .c file(s)

Study of Data Structures The study of data structures moves constantly between all three views: ADT view is constant from one language to the next Interface view allows you to compare implementations using common terminology Implementation allows you to see how it is done

The Classic ADTs Simple collections: Arranged by position: Bag Ordered bag Arranged by position: List (Indexed) Ordered by insertion: Stack Queue Deque Ordered by removal: Priority queue Unique elements: Set Key/value associations: Map (dictionary)

The Classic Implementation Techniques Arrays and Vectors Linked Lists Binary Trees, Balanced Trees Heaps Hash Tables Skip Lists Etc., etc., etc.