Presentation is loading. Please wait.

Presentation is loading. Please wait.

Copyright © Texas Education Agency, 20131 Advanced Computer Programming Data Structures: Basics.

Similar presentations


Presentation on theme: "Copyright © Texas Education Agency, 20131 Advanced Computer Programming Data Structures: Basics."— Presentation transcript:

1 Copyright © Texas Education Agency, 20131 Advanced Computer Programming Data Structures: Basics

2 Overview Why Data Structures? Collections Purpose of Data Structures Common Data Structures Basic Terms Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures2

3 Why Data Structures? Computer Programming is essentially a way to model or simulate things in the real world. Data Structures allow for a reasonable representation for how objects in the real world are collected and manipulated. What are some ways things are grouped? Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures3

4 Collections Collections can be random like clusters of stars or a brace of ducks. Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures4

5 Collections Collections can also be ordered like a deck of cards where you only want access to the top card. Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures5

6 Collections Or, you might want to simulate waiting in line, as you would for an elevator, at a traffic light, or in line for movie tickets. Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures6

7 Purpose of Data Structures The Purpose of Data Structures is to increase the speed and efficiency of data usage, while at the same time minimizing the memory requirements. Why use 20 variables when you can use one? How long would it take to check 1 million names to find someone’s address? Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures7

8 Common Data Structures ArrayList Stack Queue (implemented as a LinkedList in Java) Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures8

9 Basic Terms Iterator – most data structures have iterators. An iterator is an object that allows you to look at each of the elements in a collection, one by one. They are the foundation for how a for-each loop works. Example: // given a List named list with a number of Strings: for(String str : list) { System.out.println(str); } Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures9

10 Basic Terms Generics – a way to template data structures to use any type of object. You would otherwise be limited to only one type of object per data Structure Example: // you can specify any datatype for a data structure Stack stack; // would be a stack of Strings Stack stack; // would be a stack of Integers // generics allow us to make these choices as we use them // instead of having to rewrite the code for the Stack. Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures10

11 Basic Terms AutoBoxing – in some languages, like Java, the interpreter will automatically convert some Objects to and from their primitive data type (int to Integer and back, for example). Example: List list; // …insert a number of Integers into the list… for(int i : list) // converts from Integer to int { System.out.println(i); } Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures11

12 Attribution Ticket line image created by author. Permission is granted for public domain use. Galaxy image on slide 4 is a public domain image from NASA: http://grin.hq.nasa.gov/http://grin.hq.nasa.gov/ All other images are royalty free Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures12


Download ppt "Copyright © Texas Education Agency, 20131 Advanced Computer Programming Data Structures: Basics."

Similar presentations


Ads by Google