Representing Structure and Behavior

Slides:



Advertisements
Similar presentations
Stacks, Queues, and Linked Lists
Advertisements

Recursion vs. Iteration The original Lisp language was truly a functional language: –Everything was expressed as functions –No local variables –No iteration.
Stacks, Queues, and Deques. 2 A stack is a last in, first out (LIFO) data structure Items are removed from a stack in the reverse order from the way they.
© 2006 Pearson Addison-Wesley. All rights reserved8-1 Chapter 8 Queues CS102 Sections 51 and 52 Marc Smith and Jim Ten Eyck Spring 2008.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
CS 106 Introduction to Computer Science I 12 / 11 / 2006 Instructor: Michael Eckmann.
1 Data Structures  We can now explore some advanced techniques for organizing and managing information  Chapter 12 of the book focuses on: dynamic structures.
Chapter 12 C Data Structures Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Stacks. What is a stack? A stack is a Last In, First Out (LIFO) data structure Anything added to the stack goes on the “top” of the stack Anything removed.
COMP 110 Introduction to Programming Mr. Joshua Stough.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 – Data Structures Outline 12.1Introduction.
CS 106 Introduction to Computer Science I 12 / 13 / 2006 Instructor: Michael Eckmann.
Stacks, Queues, and Deques
Stacks, Queues, and Deques. A stack is a last in, first out (LIFO) data structure –Items are removed from a stack in the reverse order from the way they.
Stacks, Queues, and Deques
Problem Solving with Data Structures using Java: A Multimedia Approach Chapter 1: Objects for Modeling a World.
Lists, Stacks, Queues Svetlin Nakov Telerik Corporation
Copyright © Wondershare Software Introduction to Data Structures Prepared by: Eng. Ahmed & Mohamed Taha.
Chapter 12 Data Structure Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
Data Structures Winter What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important.
ISOM MIS 215 Module 3 – Stacks and Queues. ISOM Where are we? 2 Intro to Java, Course Java lang. basics Arrays Introduction NewbieProgrammersDevelopersProfessionalsDesigners.
Introduction to Data Structures. Definition Data structure is representation of the logical relationship existing between individual elements of data.
Chapter 8 Data Abstractions Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Lists ADT (brief intro):  Abstract Data Type  A DESCRIPTION of a data type  The data type can be anything: lists, sets, trees, stacks, etc.  What.
Introduction to Modeling CS1316: Representing Structure and Behavior.
Introduction to Modeling CS1316: Representing Structure and Behavior.
Chapter 12: Collections by Lewis and Loftus (Updated by Dan Fleck) Coming up: Collections.
1 Linked-list, stack and queue. 2 Outline Abstract Data Type (ADT)‏ Linked list Stack Queue.
Chapter 16 – Data Structures and Recursion. Data Structures u Built-in –Array –struct u User developed –linked list –stack –queue –tree Lesson 16.1.
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.
Stacks as an Abstract Data Type CS1316: Representing Structure and Behavior.
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.
Collections ABCD ABCD Head Node Tail Node array doubly linked list Traditional Arrays and linked list: Below is memory representation of traditional.
Mohammed I DAABO COURSE CODE: CSC 355 COURSE TITLE: Data Structures.
Queues Chapter 8 (continued)
Data Abstraction & Problem Solving with C++
G.PULLAIAH COLLEGE OF ENGINEERING AND TECHNOLOGY
Data Structure By Amee Trivedi.
12 Collections Software Solutions Lewis & Loftus java 5TH EDITION
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.
Chapter 12 – Data Structures
COSC160: Data Structures: Lists and Queues
Data Structure Interview Question and Answers
CS 1114: Implementing Search
Abstraction A tool (concept) to manage complexity
Problems with Linked List (as we’ve seen so far…)
Stacks and Queues.
Data Structures Interview / VIVA Questions and Answers
Introduction to Data Structure
structures and their relationships." - Linus Torvalds
Introduction to Modeling
Stacks, Queues, and Deques
structures and their relationships." - Linus Torvalds
Arrays and Linked Lists
Stacks, Queues, and Deques
Lesson Objectives Aims
Data Structures – Stacks and Queus
ITEC 2620M Introduction to Data Structures
Introduction to Data Structures
Stack A data structure in which elements are inserted and removed only at one end (called the top). Enforces Last-In-First-Out (LIFO) Uses of Stacks Evaluating.
Mutable Data (define mylist (list 1 2 3)) (bind ((new (list 4)))
Data Structures and Algorithms for Information Processing
Introduction to Data Structure
Stacks, Queues, and Deques
OPIM 915 Fall 2010 Data Structures 23-38,
structures and their relationships." - Linus Torvalds
Lecture 9: Stack and Queue
Queues.
Stack Implementations
Presentation transcript:

Representing Structure and Behavior CS1316: Representing Structure and Behavior

Story Techniques for representing data structure Arrays, linked lists, circular linked lists, trees, graphs, stacks, queues, event queues Techniques for representing behavior Functions (in Python), methods (in Java) Techniques for representing both Objects (what they know, and what they know how to do) Simulations Functional branches in a tree Messages in a simulation Techniques for describing structure and behavior outside a program UML class diagrams, Abstract Data Types (ADTs) What’s a program?

The Point of this Course Real computer-based media developers rarely work in terms of pixels and samples Computer musicians deal in terms of notes, instruments, patches, and other structures. Computer animators deal in terms of characters, movement, scenes, and other structures Bottom-line: They structure their media.

Driving Questions of the Course How did the wildebeest’s charge over the ridge in The Lion King? How did the villages wave in The Hunchback of Notre Dame?

The Wildebeests in The Lion King

The Villagers in The Hunchback of Notre Dame

The answer: Modeling and Simulation These are two of the (rare) times that Disney stepped away from their traditional drawn cel animation. Instead they: Modeled the structure of wildebeests and villagers, Modeled the behavior of wildebeests (how they stampede) and villagers (how they wave), Then started a computer simulation that executed the models…and basically filmed the screen.

How did they do that?

Data structures and their properties: Arrays Arrays are efficient in memory Everything is packed together Uses no additional memory Very fast for accessing any individual element They are hard to insert and delete with. Have to move everything around They can’t be grown. They have a fixed size.

Linked Lists Uses extra memory to record next Simple to insert and delete elements within Reconnect, disconnect Have to find elements to access them Can grow as large as memory allows

Circular linked lists Good for describing data that loops But don’t try to traverse them using any normal traversal!

Trees Uses branch nodes that represent both next but children. In binary trees, every node represents left and right. All the advantages of linked lists, but can also representing hierarchy or clustering.

Graphs Like trees, but arbitrary linking. Anything can link to anything else, including loops. Good for representing things like highway systems and blood paths and other real things.

Stack A LIFO (Last In First Out) list. We described it as an ADT (Abstract Data Type) What methods it understands (push, pop, peek, size, empty) What those methods do. We used it for reversing a list.

Queue A FIFO (First In First Out) list We described it as an ADT, too. We used it to represent agents lining up for a resource in a simulation

Event Queue It’s a queue where elements are kept in a sorted order. For us, it was in order of event times. We needed the earliest time to be at the top of the queue.

Representing behavior Functions in Python describe behavior. They take data in as input and act upon it Sometimes returning other data Methods in Java describe behavior They can act just like functions, but they can also manipulate this—the object that the method is part of.

ADT’s Describing the methods Describing how they work Push, pop, peek, size, empty Describing how they work Pop off the head Push onto the tail If you write your programs expecting any implementation of a given ADT, your program will work even when the ADT implementation changes.

Representing both Objects Keep instance (and class “static”) data and its structure—what they “know” Keep methods for describing behavior on that data—what they “know how” Objects represent both structure and behavior Objects were originally invented in order to do simulations. All programs can be thought of as simulations.

Embedding behavior in our structures Branches in trees that manipulate their children Scaling in sound trees Moving and vertical/horizontal placement in picture trees Messages in simulations are data that trigger behavior “Now, you’re at the factory”

How do we describe this stuff? Describing structure and behavior is modeling Obviously, a program can, but that’s a very detailed description. Anything easier to grasp, to see without so much implementation detail? I

UML class diagrams Represent both structure and behavior

What’s a program? As we started with in CS1315: A program is a specification of process, so exact that it can be executed by a machine. It’s the same thing now, at the end of CS1316. But…

Where’s the program? The program is embedded in representations of structure and behavior. It’s in that tree that holds your hierarchy. And in those messages that tell your agents what to do. And in how that queue works. And throughout the insertAfter(), and add(), and last() and other methods of your data structures. And in ALL those objects that you create and use. Programs are distributed across your representations of structure and behavior. In a real sense, “Representing Structure and Behavior” means “Advanced Programming.”