/
Data Structures Data Structures

Data Structures - PowerPoint Presentation

olivia-moreira
olivia-moreira . @olivia-moreira
Follow
405 views
Uploaded On 2016-06-30

Data Structures - PPT Presentation

IS 101YCMSC 101 Computational Thinking and Design Thursday October 3 2013 Marie desJardins University of Maryland Baltimore County Quiz Individual quiz 5 minutes Team quiz 5 minutes ID: 383759

data list relationships tree list data tree relationships nodes semester game item semantic examples current picture edges graph sort

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Data Structures" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Slide1

Data Structures

IS 101Y/CMSC 101

Computational Thinking and Design

Thursday, October 3, 2013

Marie desJardins

University of Maryland, Baltimore CountySlide2

Quiz

Individual quiz:

5 minutes

Team quiz:

5 minutesSlide3

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 elementsSlide4

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 decompositionSlide5

Tree Exercise

Use a tree to alphabetize yourselves

Who is the root of your tree?

Who are the leaves?Slide6

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 networksSlide7

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 useSlide8

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?Slide9

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 listSlide10

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?Slide11

Data Design for the Semester Game

For each week, what do you need to keep track of?Slide12

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)Slide13

NOTICE:

Important

Project Hint

Coming up!!!Slide14

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.