Presentation is loading. Please wait.

Presentation is loading. Please wait.

Data Structures IS 101Y/CMSC 101 Computational Thinking and Design Thursday, October 3, 2013 Marie desJardins University of Maryland, Baltimore County.

Similar presentations


Presentation on theme: "Data Structures IS 101Y/CMSC 101 Computational Thinking and Design Thursday, October 3, 2013 Marie desJardins University of Maryland, Baltimore County."— Presentation transcript:

1 Data Structures IS 101Y/CMSC 101 Computational Thinking and Design Thursday, October 3, 2013 Marie desJardins University of Maryland, Baltimore County

2 Quiz Individual quiz: 5 minutes Team quiz: 5 minutes

3 Data Structures Definition: A particular way of storing and organizing data in a computer so that it can be used efficiently Examples Variable – a single data element - the simplest data structure Array – an ordered list of data elements Tree – stay tuned Graph – ditto Priority, FIFO and LIFO queues – sorted arrays Tuple – a defined collection of related data elements

4 Trees A set of nodes and edges An edge between two nodes indicates there is some sort of relationship between them No circular relationships Has a “root” node and “leaf” nodes Examples Telephone tree Family tree Functional decomposition

5 Tree Exercise Use a tree to alphabetize yourselves Who is the root of your tree? Who are the leaves?

6 Graphs A set of nodes and edges An edge between two nodes indicates there is some sort of relationship between them No circular relationships Examples Maps Social networks Semantic networks

7 Semantic Network Exercise Exercise – random collection of (large) objects on the floor in the middle of the classroom Cell phone T-shirt Book Hat Skillet Spatula Lamp Piece of fruit Bag of chips Other kind of shirt Light bulb Ear buds Flashlight Batteries Some sort of connectors – several different colors Yarn and tape? How are the objects related – identify different kinds of relationships Is part of Same color Similar function Same general category of thing Used together Have students suggest different kinds of relationships – use yarn of different colors to connect objects with different kinds of relationships NOTE: I can put together a “kit” of all these things that we can both use

8 Semantic Network A graph where the nodes represent concepts and the edges represent relationships between those concepts Used to organize complex information Examples Ontologies – includes terms and definitions in a particular domain, e.g. medicine, architecture Brainstorming – some techniques use a semantic network as a way to capture the results of the brainstorming The human brain?

9 Recursion A structure or process that is defined self-referentially Recursive definition of a list of items: A list is either: an empty list (no items) or a single item followed by a list Recursive definition of an algorithm for searching for a particular item in a list: Find the middle item in the list If that’s the item you’re looking for You’re done Else Search the first half of the list Search the second half of the list

10 Semester Game What information needs to be stored? How might you organize it? By week? By choice? By outcome? Could you use a tree? Could you use a graph?

11 Data Design for the Semester Game For each week, what do you need to keep track of?

12 Similarly, for Crash For each “floating animal”, what do we need to keep track of? image – the picture of the animal xpos – the current X position of the picture ypos – the current Y position of the picture xdir – the current horizontal direction and speed ydir – the current vertical direction and speed times – how long the picture has been on the screen Solution: we’re using an array for each of these data items (see CrashBasics.pde)

13 NOTICE: Important Project Hint Coming up!!!

14 Data Design for the Semester Game Crash, conceptually, is a very similar problem to the Semester Game The same approach (using arrays) that we used in CrashBasics can be used for the Semester Game.


Download ppt "Data Structures IS 101Y/CMSC 101 Computational Thinking and Design Thursday, October 3, 2013 Marie desJardins University of Maryland, Baltimore County."

Similar presentations


Ads by Google