David Notkin Autumn 2009 CSE303 Lecture 7 bash today, C tomorrow Quick reprise: debugging, performance What’s homework 2B? (yes, it’s posted) Some looks.

Slides:



Advertisements
Similar presentations
Growth-rate Functions
Advertisements

Searching for Data Relationship between searching and sorting Simple linear searching Linear searching of sorted data Searching for string or numeric data.
Announcements You survived midterm 2! No Class / No Office hours Friday.
1 CS101 Introduction to Computing Lecture 17 Algorithms II.
Inpainting Assigment – Tips and Hints Outline how to design a good test plan selection of dimensions to test along selection of values for each dimension.
CSE373: Data Structures & Algorithms Lecture 24: The P vs. NP question, NP-Completeness Nicki Dell Spring 2014 CSE 373 Algorithms and Data Structures 1.
Q-1 University of Washington Computer Programming I Lecture 16: Sorting © 2000 UW CSE.
Data Structures Data Structures Topic #13. Today’s Agenda Sorting Algorithms: Recursive –mergesort –quicksort As we learn about each sorting algorithm,
Searching and Sorting Topics  Sequential Search on an Unordered File  Sequential Search on an Ordered File  Binary Search  Bubble Sort  Insertion.
CSE332: Data Abstractions Lecture 2: Math Review; Algorithm Analysis Tyler Robison Summer
David Notkin Autumn 2009 CSE303 Lecture 6 HW 2A in focus anagram raga Man computer science (&) engineering epic reticence ensuring gnome notkin beard drank.
CSE332: Data Abstractions Lecture 2: Math Review; Algorithm Analysis Dan Grossman Spring 2010.
CSE332: Data Abstractions Lecture 12: Introduction to Sorting Tyler Robison Summer
CSE332: Data Abstractions Lecture 27: A Few Words on NP Dan Grossman Spring 2010.
CS 206 Introduction to Computer Science II 09 / 10 / 2008 Instructor: Michael Eckmann.
Tirgul 8 Universal Hashing Remarks on Programming Exercise 1 Solution to question 2 in theoretical homework 2.
Lecture 33 CSE 331 Nov 20, Homeworks Submit HW 9 by 1:10PM HW 8 solutions at the end of the lecture.
Cmpt-225 Algorithm Efficiency.
Wednesday, 11/13/02, Slide #1 CS 106 Intro to CS 1 Wednesday, 11/13/02  QUESTIONS??  Today:  More on searching a list; binary search  Sorting a list;
27-Jun-15 Profiling code, Timing Methods. Optimization Optimization is the process of making a program as fast (or as small) as possible Here’s what the.
1 Section 2.3 Complexity of Algorithms. 2 Computational Complexity Measure of algorithm efficiency in terms of: –Time: how long it takes computer to solve.
Search Lesson CS1313 Spring Search Lesson Outline 1.Searching Lesson Outline 2.How to Find a Value in an Array? 3.Linear Search 4.Linear Search.
C++ Crash Course Class 1 What is programming?. What’s this course about? Goal: Be able to design, write and run simple programs in C++ on a UNIX machine.
Sequence comparison: Local alignment Genome 559: Introduction to Statistical and Computational Genomics Prof. William Stafford Noble.
CSE 486/586 CSE 486/586 Distributed Systems PA Best Practices Steve Ko Computer Sciences and Engineering University at Buffalo.
TODAY IN ALGEBRA…  Learning Goal: 7.2 You will solve systems of linear equations by Substitution  Independent Practice.
Introduction CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
MA/CSSE 473 Day 03 Asymptotics A Closer Look at Arithmetic With another student, try to write a precise, formal definition of “t(n) is in O(g(n))”
General Computer Science for Engineers CISC 106 Lecture 07 James Atlas Computer and Information Sciences 06/29/2009.
SEARCHING, SORTING, AND ASYMPTOTIC COMPLEXITY Lecture 12 CS2110 – Fall 2009.
Files COP3275 – PROGRAMMING USING C DIEGO J. RIVERA-GUTIERREZ.
CSE332: Data Abstractions Lecture 14: Beyond Comparison Sorting Dan Grossman Spring 2012.
CSE 326: Data Structures Lecture #16 Hashing HUGE Data Sets (and two presents from the Database Fiancée) Steve Wolfman Winter Quarter 2000.
MS 101: Algorithms Instructor Neelima Gupta
MS 101: Algorithms Instructor Neelima Gupta
Cliff Shaffer Computer Science Computational Complexity.
CSE373: Data Structures & Algorithms Lecture 22: The P vs. NP question, NP-Completeness Lauren Milne Summer 2015.
Prolog Program Style (ch. 8) Many style issues are applicable to any program in any language. Many style issues are applicable to any program in any language.
Clustering Prof. Ramin Zabih
1 Algorithms  Algorithms are simply a list of steps required to solve some particular problem  They are designed as abstractions of processes carried.
Sorting.
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.
Design time and Run time Chris, Andrea, Martina, Henry, Antonio, Ole, Philippe, Hartmut, Anne, Jeff, Felix, Sebastian, Kurt.
Searching and Sorting Searching: Sequential, Binary Sorting: Selection, Insertion, Shell.
CS 150: Analysis of Algorithms. Goals for this Unit Begin a focus on data structures and algorithms Understand the nature of the performance of algorithms.
Q-1 University of Washington Computer Programming I Lecture 16: Sorting © 2000 UW CSE.
CSE332: Data Abstractions Lecture 12: Introduction to Sorting Dan Grossman Spring 2010.
Computer Science 1620 Sorting. cases exist where we would like our data to be in ascending (descending order) binary searching printing purposes selection.
Unit 2 Day 11 FOCS – Human Computer Interaction. Tower Building Presentation Explain your solution.
1 Algorithms Searching and Sorting Algorithm Efficiency.
CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Winter 2015.
Intro to Data Structures Concepts ● We've been working with classes and structures to form linked lists – a linked list is an example of something known.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
May 17th – Comparison Sorts
Introduction to complexity
Sorting by Tammy Bailey
CSE332: Data Abstractions Lecture 12: Introduction to Sorting
More complexity analysis & Binary Search
Binary Search and Intro to Sorting
Searching and Sorting Topics Sequential Search on an Unordered File
Big O Notation.
Manipulating lists of data
UMBC CMSC 104 – Section 01, Fall 2016
Big-O, Ω, ϴ Trevor Brown CSC263 Tutorial 1 Big-O, Ω, ϴ Trevor Brown
Sorting "There's nothing in your head the sorting hat can't see. So try me on and I will tell you where you ought to be." -The Sorting Hat, Harry Potter.
Searching, Sorting, and Asymptotic Complexity
Asymptotic complexity Searching/sorting
CSE 326: Data Structures Lecture #14
Presentation transcript:

David Notkin Autumn 2009 CSE303 Lecture 7 bash today, C tomorrow Quick reprise: debugging, performance What’s homework 2B? (yes, it’s posted) Some looks at solutions to 2A

Debugging “Debugging is important, especially since the shell is so sensitive to details. I recommend two things: (a) trying your commands individually in the command- line as you're trying to build your shell scripts; and (b) assigning and echoing ‘unnecessary’ variables in your scripts that can be used to help see what's happening step-by-step.” When things don’t work, what do you do? CSE303 Au092

Performance I'm not worried about performance (within a little bit of reason) on 2A. Bill Wulf, who served as president of the National Academy of Engineering for over a decade, once said something like: “More mistakes are made by premature optimization than for any other reason including sheer ignorance.” –OK, maybe it doesn’t work right, but at least it’s really fast. –Well, if it doesn’t have to work right, I can make it even faster! CSE303 Au093

Algorithmic complexity When dealing with a lot of data, what is usually most important about performance is the underlying algorithmic complexity –Very roughly, how many times do you need to touch each data item Examples –Finding a number in an unsorted list: linear search –Finding a number in a sorted list: linear or binary search –Sorting a list: O(N 2 ) vs. O(N log N) HW2: if you touch every entry in the dictionary many times for each input string, that might be a problem – there are 479,829 entries CSE303 Au094

5

Performance: one more thing Once you get the algorithmic complexity “right”, there can still be many ways to improve performance A classic example is that some arithmetic operations are faster to execute than others but are equivalent –x*2 vs. x+x –vs. left-shift x => [106*2= 212] Another classic example is that some operations are faster than others to execute – for example, creating (“forking”) a new process in Unix is generally more expensive than computing in the same process These, however, require some actual knowledge about the costs factors you face – without that (or at least significant experience), you’re likely to guess wrong about what is costly CSE303 Au096

Questions? CSE303 Au097