TCSS 342 Autumn 2004 Version 1.1 1 TCSS 342 Data Structures & Algorithms Autumn 2004 Ed Hong.

Slides:



Advertisements
Similar presentations
Algorithm Analysis Input size Time I1 T1 I2 T2 …
Advertisements

College of Information Technology & Design
Chapter 3 Brute Force Brute force is a straightforward approach to solving a problem, usually directly based on the problem’s statement and definitions.
22C:19 Discrete Structures Induction and Recursion Spring 2014 Sukumar Ghosh.
Analysis of Algorithms CS Data Structures Section 2.6.
Analysis of Algorithms
Introduction to Analysis of Algorithms
Analysis of Algorithms1 CS5302 Data Structures and Algorithms Lecturer: Lusheng Wang Office: Y6416 Phone:
Analysis of Algorithms. Time and space To analyze an algorithm means: –developing a formula for predicting how fast an algorithm is, based on the size.
© 2004 Goodrich, Tamassia Selection1. © 2004 Goodrich, Tamassia Selection2 The Selection Problem Given an integer k and n elements x 1, x 2, …, x n, taken.
1 TCSS 342, Winter 2005 Lecture Notes Course Overview, Review of Math Concepts, Algorithm Analysis and Big-Oh Notation Weiss book, Chapter 5, pp
DAST 2005 Week 4 – Some Helpful Material Randomized Quick Sort & Lower bound & General remarks…
The Design and Analysis of Algorithms
CSE 220 (Data Structures and Analysis of Algorithms) Instructor: Saswati Sarkar T.A. Dimosthenes Anthomelidis
22C:19 Discrete Math Induction and Recursion Fall 2011 Sukumar Ghosh.
Data Structures and Programming.  John Edgar2.
Abstract Data Types (ADTs) Data Structures The Java Collections API
(c) University of Washingtonhashing-1 CSC 143 Java Hashing Set Implementation via Hashing.
TCSS 342 Lecture Notes Course Overview, Review of Math Concepts,
Week 2 CS 361: Advanced Data Structures and Algorithms
1 CS 201 Data Structures & Algorithms Chapter 1 Introduction Text: Read Weiss, §1.1 – 1.3 Izmir University of Economics.
Mathematics Review Exponents Logarithms Series Modular arithmetic Proofs.
CS 3343: Analysis of Algorithms
1 CE 221 Data Structures & Algorithms Chapter 1 Introduction Text: Read Weiss, §1.1 – 1.3 Izmir University of Economics.
1 Chapter 1 Analysis Basics. 2 Chapter Outline What is analysis? What to count and consider Mathematical background Rates of growth Tournament method.
Chapters 7, 8, & 9 Quiz 3 Review 1. 2 Algorithms Algorithm A set of unambiguous instructions for solving a problem or subproblem in a finite amount of.
Chapter 1 Introduction. Goals Why the choice of algorithms is so critical when dealing with large inputs Basic mathematical background Review of Recursion.
Course Web Page Most information about the course (including the syllabus) will be posted on the course wiki:
Introduction Algorithms and Conventions The design and analysis of algorithms is the core subject matter of Computer Science. Given a problem, we want.
Computer Science Department Data Structure & Algorithms Lecture 8 Recursion.
ดร.สุรศักดิ์ มังสิงห์ SPU, Computer Science Dept.
Order Statistics. Order statistics Given an input of n values and an integer i, we wish to find the i’th largest value. There are i-1 elements smaller.
Prepared By Ms.R.K.Dharme Head Computer Department.
1 CSC 427: Data Structures and Algorithm Analysis Fall 2010 See online syllabus (also available through BlueLine): Course goals:
ALGORITHM CHAPTER 8. Chapter Outlines and Objectives  Define an algorithm and relate it to problem solving.  Define three construct and describe their.
Data Structures and Algorithms Introduction to Algorithms M. B. Fayek CUFE 2006.
Introduction to Data Structures and Algorithms CS 110: Data Structures and Algorithms First Semester,
Mathematical Background and Linked Lists. 2 Iterative Algorithm for Sum Find the sum of the first n integers stored in an array v : sum (v[], n) temp_sum.
Algorithm Analysis CS 400/600 – Data Structures. Algorithm Analysis2 Abstract Data Types Abstract Data Type (ADT): a definition for a data type solely.
Algorithms & FlowchartsLecture 10. Algorithm’s CONCEPT.
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Nicki Dell Spring 2014.
Data Structures and Algorithm Analysis Introduction Lecturer: Ligang Dong, egan Tel: , Office: SIEE Building.
Cpt S 223 – Advanced Data Structures Math Review 2
Chapter 1: Introduction
Announcements: Project 5 Everything we have been learning thus far will enable us to solve interesting problems Project 5 will focus on applying the skills.
October 3, 2001CSE 373, Autumn Mathematical Background Exponents X A X B = X A+B X A / X B = X A-B (X A ) B = X AB X N +X N = 2X N 2 N +2 N = 2 N+1.
CSE 373: Data Structures and Algorithms
27-Jan-16 Analysis of Algorithms. 2 Time and space To analyze an algorithm means: developing a formula for predicting how fast an algorithm is, based.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
CES 592 Theory of Software Systems B. Ravikumar (Ravi) Office: 124 Darwin Hall.
The Department of Engineering Science The University of Auckland Welcome to ENGGEN 131 Engineering Computation and Software Development Lecture 2 Debugging,
1 CMSC 341 Math Review. 2 Exponents Identities (X A ) B = X AB X A * X B = X A+B X A / X B = X A-B X A + X B  X A+B.
Sum of Arithmetic Sequences. Definitions Sequence Series.
Remarks on Fast Exp (4/2) How do we measure how fast any algorithm is? Definition. The complexity of an algorithm is a measure of the approximate number.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Sorting Algorithms. Algorithms, revisited What is an algorithm? Wikipedia Definition: an algorithm is a definite list of well-defined instructions for.
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Winter 2015.
The material in this lecture should be review. If you have not seen it before, you should be able to learn it quickly – and on your own. So we are going.
October 2nd – Dictionary ADT
CSE 373: Data Structures and Algorithms Pep Talk; Algorithm Analysis
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Catie Baker Spring 2015.
Algorithm design and Analysis
TCSS 342, Winter 2006 Lecture Notes
CS 3343: Analysis of Algorithms
Introduction to Computer Science for Majors II
Analysis of Algorithms
Analysis of Algorithms
Data Structures and Algorithms
Analysis of Algorithms
Presentation transcript:

TCSS 342 Autumn 2004 Version TCSS 342 Data Structures & Algorithms Autumn 2004 Ed Hong

TCSS 342 Autumn 2004 Version Course Objectives (Broad) Prepare you to be a good software engineer (Specific) Learn basic data structures and algorithms –Data structures – how data is organized – Algorithms – unambiguous sequence of steps to compute something

TCSS 342 Autumn 2004 Version Software Design Goals

TCSS 342 Autumn 2004 Version Course Content Data Structures Algorithms Data Structures + Algorithms = Programs Algorithm analysis – determining how long an algorithm will take to solve a problem Who cares? Aren’t computers fast enough and getting faster?

TCSS 342 Autumn 2004 Version An Example Given an array of 1,000,000 integers, find the maximum integer in the array. Now suppose we are asked to find the kth largest element. (The Selection Problem) … ,999

TCSS 342 Autumn 2004 Version Candidate Solutions + Candidate solution 1 Sort the entire array (from small to large), using Java’s Arrays.sort() Pick out the (1,000,000 – k)th element. + Candidate solution 2 Sort the first k elements. For each of the remaining (1,000,000 – k) elements, keep the k largest in an array. Pick out the smallest of the k survivors.

TCSS 342 Autumn 2004 Version Is either solution good? Is there a better solution? How would you go about determining the answer to these questions?

TCSS 342 Autumn 2004 Version Method 1 Code each algorithm and run them to see how long they take. Problem: How will you know if there is a better program or whether there is no better program? What will happen when the number of inputs is twice as many? Three? A hundred?

TCSS 342 Autumn 2004 Version Method 2 Develop a model of the way computers work and compare how the algorithms behave in the model. Goal: To be able to predict performance at a coarse level. That is, to be able to distinguish between good and bad algorithms. Another benefit: when assumptions change, we can predict the effects of those changes.

TCSS 342 Autumn 2004 Version Why algorithm analysis? As computers get faster and problem sizes get bigger, analysis will become more important. Why? The difference between good and bad algorithms will get bigger.

TCSS 342 Autumn 2004 Version Why data structures? When programming, you are an engineer. Engineers have a bag of tools and tricks – and the knowledge of which tool is the right one for a given problem. Arrays, lists, stacks, queues, trees, hash tables, graphs.

TCSS 342 Autumn 2004 Version Software Development Practices Modular code Appropriate commenting of code –Each method needs a comment explaining its parameters and its behavior. Debugging with integrated development environment (IDE) Incremental development Unified modeling language (UML)

TCSS 342 Autumn 2004 Version Mathematical Background Exponents X A X B = X A+B X A / X B = X A-B (X A ) B = X AB X N +X N = 2X N 2 N +2 N = 2 N+1 Logarithms Definition: X A = B if and only if log X B = A.

TCSS 342 Autumn 2004 Version Logarithms, continued log AB = log A + log B Proof:

TCSS 342 Autumn 2004 Version Logarithms, Series log A/B = log A – log B log (A B ) = B log A Series binary representation of numbers

TCSS 342 Autumn 2004 Version Series Geometric progression: for a>0, a ≠ 1

TCSS 342 Autumn 2004 Version Boolean Logic Let P and Q be statements. “not P” is true if P is false. “P and Q” is true if both P and Q are true. “P or Q” is true if one of or both P or Q are true. “P implies Q” is true if P is false or Q is true (or both).