CSE 373: Data Structures and Algorithms Lecture 7: Sorting II 1

  Sorting (Part III) CSE 373 Data Structures Lecture 15

Administrivia- Introduction CSE 373 Data Structures

Analyzing code Basic operations take some amount of constant time Arithmetic (fixed-width) Assignment Access one Java field or array index Etc. (This is an approximation of reality: a very useful lie.) Consecutive statements Conditionals Loops Calls Recursion Sum of times Time of test plus slower branch Sum of iterations Time of call s body Solve recurrence equation (next lecture) CSE 373: Data Structures & Algorithms 24

Q: Should I be in CSE 373? Am I prepared to do well in the course?

Logarithms and Exponents n CSE 373: Data Structures & Algorithms 10

12/26/03CSE 373 WI 04- Introduction9 Grading Assignments and programming projects 50% Midterm 20% ›Approximately Feb. 13 (not definite yet) Final 30% ›2:30-4:20 p.m. Wednesday, March 17, 2004

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

Mathematical analysis of a variety of computer algorithms including searching, sorting, matrix multiplication, fast Fourier transform, and graph algorithms. Time and space complexity. Upper-bound, lower- bound, and average-case analysis. Introduction to NP completeness. Some machine computation is required for the implementation and comparison of algorithms. This course is offered as CSE 373 and MAT 373.

A second small roadblock CSE 373 has faced is the steep cost of funding the course.

Besides the fact that CSE 373 is only 3 credits and has no quiz section, the only major difference the fact that CSE 332 dedicates 3 weeks to dealing with parallelism and concurrency whereas CSE 373 spends more time on abstract data types. Most notably, CSE 373 goes more in-depth on the implementation of the disjoint set data structure and has more time for review of basic data structures (ex BST) whereas CSE 332 moves at a slightly faster pace to be able to make sure there's time at the end of the quarter to cover concurrency and parallelism.Acknowledgments: Many of the materials posted here and used in thecourse have been shared and refined by many other instructors and TAs in previous offerings ofCSE373, CSE332, and CSE326. This version of the course wasparticularly based on previous offerings by Ruth Anderson and Dan Grossman.Acknowledgments: Many of the materials posted here and used in thecourse have been shared and refined by many other instructors and TAs in previous offerings ofCSE373, CSE332, and CSE326. This version of the course wasparticularly based on previous offerings by Ruth Anderson, Dan Grossman, Kevin Quinn, and Hunter Zahn. 12/26/03CSE 373 WI 04- Introduction5 Office Hours Linda Shapiro – 634 CSE (Allen Center) ›MWF 9:30-10:30 or by appointment Gaurav Bhaya – to be announced Matthew Milcic – to be announced Third TA - to be announced
CSE 373: Data Structures and Algorithms. Lecture 2: Queues. Queue ADT. queue : A list with the restriction that insertions are done at one end and deletions are done at the other First-In, First-Out ("FIFO") Elements are stored in order of insertion but don't have indexes. 12/26/03CSE 373 WI 04- Introduction8 Textbook Data Structures and Algorithm Analysis in Java (or in C++), by Weiss See Web page (syllabus) for errata and source code
12/26/03CSE 373 WI 04- Introduction6 CSE 373 List Subscribe by going to the class web page. list is used for posting announcements by instructor and TAs. It is your responsibility to subscribe. It will turn out to be very helpful for assignments hints, corrections etc.
12/26/03CSE 373 WI 04- Introduction14 Data Structures: What? Need to organize program data according to problem being solved Abstract Data Type (ADT) - A data object and a set of operations for manipulating it ›List ADT with operations insert and delete ›Stack ADT with operations push and pop Note similarity to Java classes ›private data structure and public methods
12/26/03CSE 373 WI 04- Introduction10 Class Overview Introduction to many of the basic data structures used in computer software ›Understand the data structures ›Analyze the algorithms that use them ›Know when to apply them Practice design and analysis of data structures. Practice using these data structures by writing programs. Data structures are the plumbing and wiring of programs.
12/26/03CSE 373 WI 04- Introduction16 Terminology Abstract Data Type (ADT) ›Mathematical description of an object with set of operations on the object. Useful building block. Algorithm ›A high level, language independent, description of a step-by-step process Data structure ›A specific family of algorithms for implementing an abstract data type. Implementation of data structure ›A specific implementation in a specific language
12/26/03CSE 373 WI 04- Introduction15 Data Structures: Why? Program design depends crucially on how data is structured for use by the program ›Implementation of some operations may become easier or harder ›Speed of program may dramatically decrease or increase ›Memory used may increase or decrease ›Debugging may be become easier or harder
12/26/03CSE 373 WI 04- Introduction21 Proof by Induction Basis Step: The algorithm is correct for the base case (e.g. n=0) by inspection. Inductive Hypothesis (n=k): Assume that the algorithm works correctly for the first k cases, for any k. Inductive Step (n=k+1): Given the hypothesis above, show that the k+1 case will be calculated correctly.