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

Slides:



Advertisements
Similar presentations
Lists and the Collection Interface Chapter 4. Chapter Objectives To become familiar with the List interface To understand how to write an array-based.
Advertisements

Chapter 5: Elementary Data Types Properties of types and objects –Data objects, variables and constants –Data types –Declarations –Type checking –Assignment.
Arrays.
George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
Copyright by Scott GrissomCh 4 Grouping Objects Slide 1 Flexible-size Collections flexible collection of objects unlimited and unknown size iPod playlist.
Slides prepared by Rose Williams, Binghamton University Chapter 14 Generics and the ArrayList Class.
JAVA 1.5 New Features Dr V. The syntax of the enhanced for loop (for each) for (type variableName : arrayName) { statements } arrayName could be any.
Chapter 19 Java Data Structures
Building Java Programs
CSE373 Optional Section Java Collections 11/12/2013 Luyi Lu.
Data Structures Data structures permit the storage of related data for use in your program. –Arrays.
C o n f i d e n t i a l Developed By Nitendra NextHome Subject Name: Data Structure Using C Title: Overview of Data Structure.
OOP Languages: Java vs C++
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2008 Pearson Education, Inc., Upper.
Copyright © Texas Education Agency, Advanced Computer Programming Data Structures: Collections.
Lecture No.01 Data Structures Dr. Sohail Aslam
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Chapter 22 Java Collections.
Teach.NET Workshop Series Track 4: AP Computer Science with.NET and J#
AP CS Workshop ArrayList It is very common for applications to require us to store a large amount of data. Array lists store large amounts of data.
ARRAYLIST Collections of Data. ArrayLists Array lists can grow and shrink as needed ArrayList is a generic class (similar to C++ template) ArrayList has.
Generalized Containers CSIS 3701: Advanced Object Oriented Programming.
GENERIC COLLECTIONS. Type-Wrapper Classes  Each primitive type has a corresponding type- wrapper class (in package java.lang).  These classes are called.
CSC 142 J(part 1) 1 CSC 142 The ArrayList class [Reading: chapter 10]
1162 JDK 5.0 Features Christian Kemper Principal Architect Borland.
Chapter 11 Arrays Continued
AP Comp Sci A Chapter 12 - Arrays. Ch 12 Goals: Goals: Declare and create arrays Declare and create arrays Access elements in arrays Access elements in.
Some Other Collections: Bags, Sets, Queues and Maps COMP T2 Lecture 4 School of Engineering and Computer Science, Victoria University of Wellington.
Collections. The Plan ● Why use collections? ● What collections are available? ● How are the collections different? ● Examples ● Practice.
Computer Science 209 Software Development Java Collections.
Data structures Abstract data types Java classes for Data structures and ADTs.
CSS446 Spring 2014 Nan Wang  Java Collection Framework ◦ LinkedList ◦ Set ◦ Map 2.
New Tools And Workshop Mod & For Loops. Modulo Calculates the remainder (remember long division?) % Examples: 7 % 3 10 % 2 2 % 3 evaluates to 1 evaluates.
JAVA COLLECTIONS M. TAIMOOR KHAN (ADAPTED FROM SWINBURNE NOTES)
Stacks and Queues. 2 3 Runtime Efficiency efficiency: measure of computing resources used by code. can be relative to speed (time), memory (space), etc.
Lists What to do?. Lists  A list is a linear arrangement of data elements.  Items are arranged in sequential (linear) order  Items are therefore ordered.
CIS3023: Programming Fundamentals for CIS Majors II Summer 2010 Ganesh Viswanathan Generics and Collections Course Lecture Slides 19 th July 2010 “Never.
Types in programming languages1 What are types, and why do we need them?
Aug 9, CMSC 202 ArrayList. Aug 9, What’s an Array List ArrayList is  a class in the standard Java libraries that can hold any type of object.
C++ Pointers Review. Overview  What is a pointer  Why do I care?  What can be 'pointed to'?  Example.
Collections Data structures in Java. OBJECTIVE “ WHEN TO USE WHICH DATA STRUCTURE ” D e b u g.
The ArrayList Data Structure Standard Arrays at High Speed! More Safety, More Efficient, and Less Overhead!
Week 2 - Friday.  What did we talk about last time?  Computing Big Oh.
CSE 1201 Object Oriented Programming ArrayList 1.
Some Other Collections: Bags, Sets, Queues and Maps COMP T2 Lecture 4 School of Engineering and Computer Science, Victoria University of Wellington.
COMPUTER PROGRAMMING 2 ArrayLists. Objective/Essential Standard Essential Standard 3.00Apply Advanced Properties of Arrays Essential Indicator 3.02 Apply.
JAVA: An Introduction to Problem Solving & Programming, 6 th Ed. By Walter Savitch ISBN © 2012 Pearson Education, Inc., Upper Saddle River,
Topic 13 Iterators. 9-2 Motivation We often want to access every item in a data structure or collection in turn We call this traversing or iterating over.
University of Limerick1 Collections The Collection Framework.
3-1 Java's Collection Framework Another use of polymorphism and interfaces Rick Mercer.
Lecture 9:FXML and Useful Java Collections Michael Hsu CSULA.
Comp1004: Environments The Java Library. Coming up Recap – Encapsulation – Constructors – Loops – Arrays – ArrayList – Iterators The Java Library – Implementation.
New Java Features Advanced Programming Techniques.
Stacks and Queues. 2 Abstract Data Types (ADTs) abstract data type (ADT): A specification of a collection of data and the operations that can be performed.
Slides by Donald W. Smith
Prefix notation in action
Chapter VII: Arrays.
Chapter 19 Java Data Structures
Fundamentals of Java: AP Computer Science Essentials, 4th Edition
Abstraction A tool (concept) to manage complexity
What is “Data Structures”?
Data Structures 1 1.
CSE 143 Lecture 9 References and Linked Nodes reading: 3.3; 16.1
© A+ Computer Science - Arrays and Lists © A+ Computer Science -
Java For-Each loop A delightful shortcut.
Arrays and Collections
Variables Title slide variables.
Introduction to Data Structure
slides created by Alyssa Harding
Generics, Stack, Queue Based on slides by Alyssa Harding
Presentation transcript:

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

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

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

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

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

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

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

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

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

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

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

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: All other images are royalty free Copyright © Texas Education Agency, 2013IT: Advanced Computer Programming – Data Structures12