1. What are Data Structures? Introduction to Data Structures. 2. What will we Study? CITS2200 Data Structures and Algorithms



Similar documents
Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

AP Computer Science AB Syllabus 1

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015

CS 111 Classes I 1. Software Organization View to this point:

Data Types. Abstract Data Types. ADTs as Design Tool. Abstract Data Types. Integer ADT. Principle of Abstraction

Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives

Analysis of Binary Search algorithm and Selection Sort algorithm

COMPUTER SCIENCE. Paper 1 (THEORY)

MICHIGAN TEST FOR TEACHER CERTIFICATION (MTTC) TEST OBJECTIVES FIELD 050: COMPUTER SCIENCE

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Programming Languages

Chapter 6: Programming Languages

OKLAHOMA SUBJECT AREA TESTS (OSAT )

Glossary of Object Oriented Terms

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Quiz 4 Solutions EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II. 1 Q u i z 4 S o l u t i o n s

Software Testing. Definition: Testing is a process of executing a program with data, with the sole intention of finding errors in the program.

BUSINESS RULES CONCEPTS... 2 BUSINESS RULE ENGINE ARCHITECTURE By using the RETE Algorithm Benefits of RETE Algorithm...

Java 6 'th. Concepts INTERNATIONAL STUDENT VERSION. edition

LINKED DATA STRUCTURES

The Smalltalk Programming Language. Beatrice Åkerblom

Course MS10975A Introduction to Programming. Length: 5 Days

Habanero Extreme Scale Software Research Project

No no-argument constructor. No default constructor found

DATA STRUCTURES USING C

Binary Heap Algorithms

Output: struct treenode{ int data; struct treenode *left, *right; } struct treenode *tree_ptr;

Chapter 1 Fundamentals of Java Programming

The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1

HARDWARE AND SOFTWARE COMPONENTS Students will demonstrate an understanding of the relationship between hardware and software in program execution.

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

Computing Concepts with Java Essentials

50 Computer Science MI-SG-FLD050-02

Efficient database auditing

Dsc+Mock: A Test Case + Mock Class Generator in Support of Coding Against Interfaces

1 File Processing Systems

Algorithms and Data Structures Written Exam Proposed SOLUTION

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

How To Use The Command Pattern In Java.Com (Programming) To Create A Program That Is Atomic And Is Not A Command Pattern (Programmer)

Introduction to SQL for Data Scientists

Cache Database: Introduction to a New Generation Database

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

COMPUTER SCIENCE 1999 (Delhi Board)

Outline of this lecture G52CON: Concepts of Concurrency

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

Java (12 Weeks) Introduction to Java Programming Language

3 Pillars of Object-oriented Programming. Industrial Programming Systems Programming & Scripting. Extending the Example.

Object Oriented Databases. OOAD Fall 2012 Arjun Gopalakrishna Bhavya Udayashankar

CMSC 132: Object-Oriented Programming II. Design Patterns I. Department of Computer Science University of Maryland, College Park

Computer Science 210: Data Structures. Introduction

The ADT Binary Search Tree

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

A binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:

Java the UML Way: Integrating Object-Oriented Design and Programming

UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming

The Rules 1. One level of indentation per method 2. Don t use the ELSE keyword 3. Wrap all primitives and Strings

6.088 Intro to C/C++ Day 4: Object-oriented programming in C++ Eunsuk Kang and Jean Yang

1Z0-117 Oracle Database 11g Release 2: SQL Tuning. Oracle

Software Engineering Techniques

Rule-Based Engineering Using Declarative Graph Database Queries

Parallel Data Preparation with the DS2 Programming Language

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

Java EE Web Development Course Program

Ch 7-1. Object-Oriented Programming and Classes

Charles Dierbach. Wiley

Course: Programming II - Abstract Data Types. The ADT Stack. A stack. The ADT Stack and Recursion Slide Number 1

Programming by Contract. Programming by Contract: Motivation. Programming by Contract: Preconditions and Postconditions

Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture

Android Application Development Course Program

Managing a Class Hierarchy with SQL in Matisse

Overview and History of Software Engineering

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

Common Data Structures

Computer Science. General Education Students must complete the requirements shown in the General Education Requirements section of this catalog.

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

Iterators. Provides a way to access elements of an aggregate object sequentially without exposing its underlying representation.

STORM. Simulation TOol for Real-time Multiprocessor scheduling. Designer Guide V3.3.1 September 2009

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

AP Computer Science Java Subset

02-201: Programming for Scientists

Software Engineering. Software Engineering. Component-Based. Based on Software Engineering, 7 th Edition by Ian Sommerville

Fundamentals of Java Programming

Services. Relational. Databases & JDBC. Today. Relational. Databases SQL JDBC. Next Time. Services. Relational. Databases & JDBC. Today.

Computer Information Systems (CIS)

7.1 Our Current Model

.NET and J2EE Intro to Software Engineering

Java Application Developer Certificate Program Competencies

OPTIMAL BINARY SEARCH TREES

CSE373: Data Structures and Algorithms Lecture 1: Introduction; ADTs; Stacks/Queues. Linda Shapiro Spring 2016

Domains and Competencies

Java Software Structures

Introduction: Abstract Data Types and Java Review

Basic Programming and PC Skills: Basic Programming and PC Skills:

Transcription:

1 What are ata Structures? ata Structures and lgorithms ata structures are software artifacts that allow data to be stored, organized and accessed Topic 1 They are more high-level than computer memory (hardware) and lower-level than databases and spreadsheets (which associate meta-data and meaning to the stored data) Why study data structures? ollections, abstract data types (Ts), and algorithm analysis More on Ts Ultimately data structures have two core functions: put stuff in, and take stuff out What s ahead?? before m i s window s? null after Slide 1 Slide 2 2 What will we Study? Why? software is complex more than any other man made system even more so in today s highly interconnected world 21 ollections as name suggests, hold a bunch of things software is fragile smallest logical error can cause entire systems to crash nearly every nontrivial piece of software involves the use of collections neither you, nor your software, will work in a vacuum Seen arrays others include queues, stacks, lists, trees, maps, sets, tables the world is unpredictable clients are unpredictable Software must be correct, efficient, easy to maintain, and reusable F Slide 3 Slide 4

Why so many? Space efficiency Time efficiency: store (add to collection) search (find an object) retrieve (read information) remove or replace clone (make a copy) 22 bstract ata Types llow user to abstract away from implementation detail onsider the statement: IputmylunchinmybagandwenttoUni What is meant by the term bag in this context? Most likely it is a backpack, orsatchel, but it could also be a hand bag, shopping bag, sleeping bag, body bag (but probably not a bean bag) It doesn t actually matter To parse the statement above, we simply understand that a bag is something that we can 1 put things in, 2 carry places, and 3 take things out Such a specification is an bstract ata Type c Tim French Slide 5 c Tim French Slide 6 23 lgorithm nalysis We will consider a number of alternative implementations for each T Which is best? Simplicity and larity ll things being equal we prefer simplicity, but they rarely are Space fficiency space occupied by data overheads space required by algorithm (eg recursion) canitblowout? Time fficiency Time performance of algorithms can vary greatly xample: Finding a word in the dictionary lgorithm 1: Look through each word in turn until you find a match lgorithm 2: go to half way point compare your word with the word found if < repeat on earlier half else > repeat on later half c Tim French Slide 7 c Tim French Slide 8

Performance lgorithm 1 (exhaustive search) proportional to n/2 lgorithm 2 (binary search) proportional to log n number of lgorithm 1 lgorithm 2 words max comparisons max comparisons 10 10 4 100 100 7 1000 1000 10 10000 10000 14 100000 100000 17 1000000 1000000 20 24 Ts and Java Object-oriented programming was originally based around the concept of abstract data types Java classes are ideal for implementing Ts Ts require: Some references (variables) for holding the data (usually hidden from the user) Some operations that can be performed on the data (available to the user) c Tim French Slide 9 c Tim French Slide 10 classinjavahasthegeneralstructure 25 Information Hiding class declaration variable declarations method declarations // data held // operations on the data Variables can be made private noaccessbyusers Methods can be made public usedtocreateandmanipulatedatastructure This encapsulation is good programming practice canchange the way the data is stored the way the methods are implemented without changing the (external) functionality c Tim French Slide 11 c Tim French Slide 12

xample: Matrix lass public class Matrix { private int[][] matrixrray; public Matrix (int rows, int columns) { matrixrray = new int[rows][columns]; matrixrray[i][j] = 0; public void set (int i, int j, int value) { matrixrray[i][j]=value; public int get (int i, int j) {return matrixrray[i][j]; public void transpose () { int rows = matrixrraylength; int columns = matrixrray[0]length; int[][] temp = new int[columns][rows]; temp[j][i] = matrixrray[i][j]; matrixrray = temp; c Tim French Slide 13 c Tim French Slide 14 Q: What is the time performance of transpose()? For a matrix with n rows and m columns, how many (array access) operations are needed? an you think of a more efficient implementation? One that doesn t move any data? public class MatrixReloaded { private int[][] matrixrray; private boolean istransposed; public MatrixReloaded (int rows, int columns) { matrixrray = new int[rows][columns]; matrixrray[i][j] = 0; istransposed = false; c Tim French Slide 15 c Tim French Slide 16

public void set (int i, int j, int value) { What is the time performance of transpose()? public int get (int i, int j) { oes it depend on the size of the array? How do the changes affect the user s program? public void transpose () { c Tim French Slide 17 c Tim French Slide 18 26 dvantages of Ts modularity independent development, re-use, portability, maintainability, upgrading, etc delay decisions about final implementation separate concerns of application and data structure design information hiding (encapsulation) access by well-defined interface lso other OO benefits like: polymorphism same operation can be applied to different types inheritance subclasses adopt from parent classes c Tim French Slide 19 c Tim French Slide 20