CS261 Data Structures Fall 2009 Professor Timothy Budd.

Slides:



Advertisements
Similar presentations
Software Engineering and Design Principles Chapter 1.
Advertisements

George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.
June 13, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
CMSC 132: Object-Oriented Programming II
CMSC 132: Object-Oriented Programming II Nelson Padua-Perez William Pugh Department of Computer Science University of Maryland, College Park.
CS261 Data Structures Winter 2011 Professor Timothy Budd.
1 Data Structures A program solves a problem. A program solves a problem. A solution consists of: A solution consists of:  a way to organize the data.
 2007 Pearson Education, Inc. All rights reserved C Functions.
CS101- Lecture 11 CS101 Fall 2004 Course Introduction Professor Douglas Moody –Monday – 12:00-1:40 – – –Web Site: websupport1.citytech.cuny.edu.
Administrivia- Introduction CSE 373 Data Structures.
CS 106 Introduction to Computer Science I 03 / 30 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 03 / 03 / 2008 Instructor: Michael Eckmann.
CS Winter 2010 Big-Oh Review. A Machine-independent Way to Describe Execution Time The purpose of a big-Oh characterization is to describe the change.
1 ES 314 Advanced Programming Lec 2 Sept 3 Goals: Complete the discussion of problem Review of C++ Object-oriented design Arrays and pointers.
CS Winter 2011 Abstract Data Types. Container Classes Over the years, programmers have identified a small number of different ways of organizing.
CS 106 Introduction to Computer Science I 10 / 15 / 2007 Instructor: Michael Eckmann.
CS 106 Introduction to Computer Science I 10 / 16 / 2006 Instructor: Michael Eckmann.
July 16, Introduction to CS II Data Structures Hongwei Xi Comp. Sci. Dept. Boston University.
1 CSC 221: Computer Programming I Fall 2004 course overview  what did we set out to learn?  what did you actually learn?  where do you go from here?
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Carolyn Seaman University of Maryland, Baltimore County.
1 CSC103: Introduction to Computer and Programming Lecture No 13.
Session 05: C# Patterns Algorithm Patterns: Sweep Search FEN AK IT: Softwarekonstruktion.
1 C++ Plus Data Structures Nell Dale Chapter 7 Programming with Recursion Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus.
CSCI-383 Object-Oriented Programming & Design Lecture 4.
Data Structures and Programming.  Today:  Administrivia  Introduction to 225, Stacks  Course website: 
Recursion Examples Fundamentals of CS Case 1: Code /* Recursion: Case 1 */ #include void count (int index); main () { count (0); getchar(); } void count.
Java: Chapter 1 Computer Systems Computer Programming II.
EECE 310 Software Engineering Lecture 0: Course Orientation.
FALL 2001ICOM Lecture 21 ICOM 4015 Advanced Programming Lecture 2 Procedural Abstraction Reading: LNN Chapter 4, 14 Prof. Bienvenido Velez.
IT253: Computer Organization Lecture 4: Instruction Set Architecture Tonga Institute of Higher Education.
ITEC 2620A Introduction to Data Structures
Invitation to Computer Science, Java Version, Second Edition.
Recursion l Powerful Tool l Useful in simplifying a problem (hides details of a problem) l The ability of a function to call itself l A recursive call.
1 Chapter 13 Recursion. 2 Chapter 13 Topics l Meaning of Recursion l Base Case and General Case in Recursive Function Definitions l Writing Recursive.
Abstraction IS 101Y/CMSC 101 Computational Thinking and Design Tuesday, September 17, 2013 Marie desJardins University of Maryland, Baltimore County.
Chapter 13 Recursion. Learning Objectives Recursive void Functions – Tracing recursive calls – Infinite recursion, overflows Recursive Functions that.
CSCI 51 Introduction to Computer Science Dr. Joshua Stough January 20, 2009.
By the end of this session you should be able to...
1 CSC 222: Computer Programming II Spring 2004 See online syllabus at: Course goals:
Introduction to Data Structures
Recursion. What is recursion? Rules of recursion Mathematical induction The Fibonacci sequence Summary Outline.
Multidimensional Arrays. 2 Two Dimensional Arrays Two dimensional arrays. n Table of grades for each student on various exams. n Table of data for each.
 A Collection class is a data type that is capable of holding a group of items.  In Java, Collection classes can be implemented as a class, along with.
C++ and Ubuntu Linux Review and Practice CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and.
Introduction to Computer Programming (FIT-I pro) J. H. Wang Sep. 17, 2007.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
1 CSC 221: Computer Programming I Spring 2008 course overview  What did we set out to learn?  What did you actually learn?  Where do you go from here?
Chapter 3 Top-Down Design with Functions Part II J. H. Wang ( 王正豪 ), Ph. D. Assistant Professor Dept. Computer Science and Information Engineering National.
Loops Robin Burke IT 130. Outline Announcement: Homework #6 Conditionals (review) Iteration while loop while with counter for loops.
2.1 Functions. Functions in Mathematics f x y z f (x, y, z) Domain Range.
1 CS 311 Data Structures. 2 Instructor Name : Vana Doufexi Office : 2-229, Ford Building Office hours: By appointment.
2 Chapter 21 Understanding Structure Programming Logic and Design, Second Edition, Comprehensive 2.
Data Structure Introduction Dr. Bernard Chen Ph.D. University of Central Arkansas Fall 2010.
CS 106 Introduction to Computer Science I 03 / 02 / 2007 Instructor: Michael Eckmann.
Chapter More on Classes Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg.
Chapter 5 Methods 1. Motivations Method : groups statements that perform a function.  Level of abstraction (black box)  Code Reuse – no need to reinvent.
Chapter 2: Algorithm Discovery and Design Invitation to Computer Science.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
CS140 – Computer Programming 1 Course Overview First Semester – Fall /1438 – 2016/2017 CS140 - Computer Programming 11.
CSC 222: Object-Oriented Programming
CSC 222: Object-Oriented Programming
CSC 222: Computer Programming II
UMBC CMSC 104 – Section 01, Fall 2016
CSc 020: Programming Concepts and Methodology II
CSC 221: Computer Programming I Fall 2005
Subprograms and Programmer Defined Data Type
Introduction CSE 373 Data Structures.
Administrivia- Introduction
IPC144 Introduction to Programming Using C Week 4 – Lesson 1
Administrivia- Introduction
Presentation transcript:

CS261 Data Structures Fall 2009 Professor Timothy Budd

Why data structures By this point, you have learned the mechanics of coding - variables, loops, etc This course will help you take the next step in becoming a programming, learning higher level skills, such as abstraction, modularization, correctness, efficiency.

Administrivia Go over administrivia - Two midterms, one final Several programming assignments, several homeworks Recitations used for learning programming skills, course will deal more with concepts

More administrivia I’m found in KEC 3049 OH: MWF 1:30 - 3:00 for now Two TA’s: they will each hold office hours as well in KEC lobby (see web page)

Textbook Textbook is on-line, also with links to many articles (wikipedia and so on) for further information. You should print it out Textbook begins with material you should already have seen - read chapters 1 to 5 immediately.

Active Learning This course uses a technique termed Active Learning We do worksheets most every day. Worksheets can be done in groups, helping each other They are gathered and recorded, but only lightly graded

Why Data Structures? The study of data structures is considered the cornerstone and starting point for systematic examination of computer science Notice I said computer science, not just programming

Ubiquitous Certain collection classes are found in almost every nontrivial program Knowing these keeps you from having to reinvent the wheel

Vocabulary The common data structures have well known names Helps provide a vocabulary that is shared by all computer professionals

Abstraction Data structures are one of the easiest ideas to visualize abstractly Abstraction is the key idea used by computer professionals to control complexity.

Information Hiding and Large Projects An important part of abstraction is information hiding - what details do you NOT need to know? Key to modern large software projects What does programmer A NOT need to know to use the work of programmer B?

Tools and Techniques The analysis of data structures provides a good vehicle to learn a variety of mathematical and other analytical techniques Recursion, big-Oh, counting arguments, proof of correctness

Design Pattern format A very useful and recent tool Design patterns provide a way to document proven solutions to common problems More importantly, provide a vocabulary Grew out of OO world, starting to become common everywhere else

Features of Design pattern Problem: Short statement of problem Solution: Abstract characteristics Forces: Reasons for using pattern Counter-Forces: Reasons for NOT using pattern Example - Façade (change in interface, not in implementation)

Questions?? If not, then we do our first worksheet

What is O( ) int countOccurrences (double data [ ], int n, double testValue) { int i; int count = 0; for (i = 0; i < n; i++) { if (data[i] == testValue) count++; } return count; }

Btw, arrays and pointers are the same. More common: int countOccurrences (double * data, int n, double testValue) { int i; int count = 0; for (i = 0; i < n; i++) { if (data[i] == testValue) count++; } return count; }

A loop that is not an array index. What is O( )? int isPrime (int n) { int i; for (i = 2; i * i <= n; i++) { if (0 == n % i) return 0; } return 1; /* 1 is true */ }

Calling a function inside another O( )? void printPrimes (int n) { int i; for (i = 2; i < n; i++) { if (isPrime(i)) printf(“Value %d is prime”, i); }

What is printf And older way to do printing (before streams). Don’t remember how to use it? Look in the handy pocket reference.

Nexted loop (Note, this is pseudo-code, not C) void matMult (int [][] a, int [][] b, int [][] c) { int n = n; // assume all same size int i, j, k; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { c[i][j] = 0; for (k = 0; k < n; k++) c[i][j] += a[i][k] * b[k][j]; }

A more subtle loop void selectionSort (double * storage, int n) { int p, i, indexLargest; for (p = n – 1; p > 0; p--) { indexLargest = 0; for (i = 1; i <= p; i++) { if (storage[i] > storage[indexLargest]) indexLargest = i; } if (indexlargest != position) swap(storage, indexLargest, position); }

What is the sum? What is the sum of … + (n - 1) ?

An operator you might have never seen for (i = n; i > 0; i = i >> 1) … What is the >> operator? Right shift. Imagine that n starts at 100. What are the values that i will go through?