Today: Office hours –No tomorrow. M/T- 3-on. Overloading operators Inheritance Review.

Slides:



Advertisements
Similar presentations
CS16: Data Structures & Algorithms | Spring 2014 Midterm Review 3/16/
Advertisements

Transform and Conquer Chapter 6. Transform and Conquer Solve problem by transforming into: a more convenient instance of the same problem (instance simplification)
CSE 373: Data Structures and Algorithms Lecture 19: Graphs III 1.
Graphs Chapter 12. Chapter Objectives  To become familiar with graph terminology and the different types of graphs  To study a Graph ADT and different.
Breadth-First and Depth-First Search
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 excerpts Graphs (breadth-first-search)
1 A Two-Level Binary Expression ‘-’ ‘8’ ‘5’ treePtr INORDER TRAVERSAL : has value 3 PREORDER TRAVERSAL: POSTORDER TRAVERSAL: 8 5 -
Advanced Data Structures
Review. What to know You are responsible for all material covered in lecture, the readings, or the programming assignments There will also be some questions.
CS 307 Fundamentals of Computer Science 1 Abstract Data Types many slides taken from Mike Scott, UT Austin.
More sorting algorithms: Heap sort & Radix sort. Heap Data Structure and Heap Sort (Chapter 7.6)
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
Review for Test 2 i206 Fall 2010 John Chuang. 2 Topics  Operating System and Memory Hierarchy  Algorithm analysis and Big-O Notation  Data structures.
Course Review COMP171 Spring Hashing / Slide 2 Elementary Data Structures * Linked lists n Types: singular, doubly, circular n Operations: insert,
Unit 11a 1 Unit 11: Data Structures & Complexity H We discuss in this unit Graphs and trees Binary search trees Hashing functions Recursive sorting: quicksort,
CS 206 Introduction to Computer Science II 03 / 25 / 2009 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 12 / 10 / 2008 Instructor: Michael Eckmann.
CS 206 Introduction to Computer Science II 11 / 09 / 2009 Instructor: Michael Eckmann.
Fall 2007CS 2251 Graphs Chapter 12. Fall 2007CS 2252 Chapter Objectives To become familiar with graph terminology and the different types of graphs To.
Review of Graphs A graph is composed of edges E and vertices V that link the nodes together. A graph G is often denoted G=(V,E) where V is the set of vertices.
Chapter 1 Introduction Definition of Algorithm An algorithm is a finite sequence of precise instructions for performing a computation or for solving.
9 Priority Queues, Heaps, and Graphs. 9-2 What is a Heap? A heap is a binary tree that satisfies these special SHAPE and ORDER properties: –Its shape.
Advanced Algorithms Analysis and Design Lecture 8 (Continue Lecture 7…..) Elementry Data Structures By Engr Huma Ayub Vine.
Chapter 9 – Graphs A graph G=(V,E) – vertices and edges
Data Structures Winter What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important.
MA/CSSE 473 Day 22 Binary Heaps Heapsort Answers to student questions Exam 2 Tuesday, Nov 4 in class.
Chapter 3 List Stacks and Queues. Data Structures Data structure is a representation of data and the operations allowed on that data. Data structure is.
CSCA48 Course Summary.
Information and Computer Sciences University of Hawaii, Manoa
Final Review Dr. Yingwu Zhu. Goals Use appropriate data structures to solve real- world problems –E.g., use stack to implement non-recursive BST traversal,
Chapter 9 Priority Queues, Heaps, Graphs, and Sets.
Big Java Chapter 16.
Common final examinations When: Wednesday, 12/11, 3:30-5:30 PM Where: Ritter Hall - Walk Auditorium 131 CIS 1166 final When: Wednesday, 12/11, 5:45-7:45.
L Please get a complete set (brown, green, red and yellow) of colored paper from the front.
Overview of Course Java Review 1. This Course Covers, using Java Abstract data types Design, what you want them to do (OOD) Techniques, used in implementation.
December 4, Algorithms and Data Structures Lecture XV Simonas Šaltenis Aalborg University
MA/CSSE 473 Day 28 Dynamic Programming Binomial Coefficients Warshall's algorithm Student questions?
CS342 Data Structures End-of-semester Review S2002.
Java Methods Big-O Analysis of Algorithms Object-Oriented Programming
The ADT Table The ADT table, or dictionary Uses a search key to identify its items Its items are records that contain several pieces of data 2 Figure.
Data Structure II So Pak Yeung Outline Review  Array  Sorted Array  Linked List Binary Search Tree Heap Hash Table.
Data Structures Chapter 6. Data Structure A data structure is a representation of data and the operations allowed on that data. Examples: 1.Array 2.Record.
1 Directed Graphs Chapter 8. 2 Objectives You will be able to: Say what a directed graph is. Describe two ways to represent a directed graph: Adjacency.
Graphs Chapter 12. Chapter 12: Graphs2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study a Graph.
 Saturday, April 20, 8:30-11:00am in B9201  Similar in style to written midterm exam  May include (a little) coding on paper  About 1.5 times as long.
Chapter 20: Graphs. Objectives In this chapter, you will: – Learn about graphs – Become familiar with the basic terminology of graph theory – Discover.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
MA/CSSE 473 Day 11 Knuth interview Amortization (growable Array) Brute Force Examples.
CSC 172 DATA STRUCTURES. MIDTERM REVIEW MIDTERM EXAM 75 min 6 – 10 questions a lot like the quiz questions.
CSC317 Selection problem q p r Randomized‐Select(A,p,r,i)
“<Fill in your definition here.>”
Graphs Chapter 15 introduces graphs which are probably the most general and commonly-used data structure. This lecture introduces heaps, which are used.
Data Structure Interview Question and Answers
Midterm Review.
Data Structures Using C++ 2E
Hashing Exercises.
Program based on pointers in C.
Cse 373 April 26th – Exam Review.
Map interface Empty() - return true if the map is empty; else return false Size() - return the number of elements in the map Find(key) - if there is an.
Chapter 9 Priority Queues, Heaps, Graphs, and Sets
original list {67, 33,49, 21, 25, 94} pass { } {67 94}
IT 4043 Data Structures and Algorithms
Final Review Dr. Yingwu Zhu.
Chapter 12 Heap ADT © 2011 Pearson Addison-Wesley. All rights reserved.
Tables and Priority Queues
Heaps Chapter 6 Section 6.9.
EE 312 Software Design and Implementation I
Presentation transcript:

Today: Office hours –No tomorrow. M/T- 3-on. Overloading operators Inheritance Review

Inheritence Weiss: “Any serious use of inheritance requires pointers and heap memory allocation.” –Makes it look more like Java, except you have to worry about garbage collection. –This is why many people say Java is better for object-oriented programming than C++. class Student : public Person {…}; More next time. Chapter 6.

Review: Object-oriented design Generics Asymptotics, O notation, recursion Sorting Lists Stacks and Queues Binary Structures OrderedList, OrderedVector Priority Queues, Heaps, Heap Sort Search Trees, Maps, Hash Tables Graphs – thoughts on how to implement C++ - syntax, generics, we built a toolbox.

Sorting Insertion / Selection Idea of Quicksort Idea of Mergesort Idea of Heapsort In what situation is insertion sort the best? Why?

Lists Write a method that computes __________ about a List (e.g., sum the elements) Write a method that does __________ to a List (e.g., insert a node in the appropriate place).

Stacks and Queues Solve depth-first, breadth-first problems using… –We’ve seen three examples: web crawler, post-fix notation, recursion.

Binary/Recursive Structures In a method _____, use the methods BT left(), BT right(), and boolean isEmpty() to compute ________ about a BT root. We have seen recursive structures BT and LinkedList. Consider an InfiniteBox, where a particular InfiniteBox contains a Vector of Integer and also an InfiniteBox. put places a number in the InfiniteBox box, either in its Vector or its InfiniteBox, depending on whether the number is a single digit long…write put.

Priority Queues, Heaps What is the idea of a priority queue? PriorityVector uses a Vector to implement the idea of a priority queue. How?

Maps and Hashtables What’s the idea behind a map? Consider a Hashtable…Here is some hash function. Why is this a poor hash function for the Hashtable? How might you make it better?

Graphs We spent some time on the adjacency matrix idea, where the indices correspond to vertices and the elements of the matrix are edges (non-null if there is an edge). How would you use this matrix to determine whether there is a path between vertex i and vertex j? Write the recursive method returning a boolean. –(This would use the visited method to set vertices to visited and prevent infinite recursion).

C++ Here is a mostly completed class definition. Fill in the missing method bodies. What additional functionality would be necessary if we were to use this class for _______? Implement this functionality. Provide the values of the variables after the following code executes. –May use pointers, referencing, etc.

Practice Questions Ch. 1 –1,2,3,5,6,7,8,10,11. –6 in C++ (I would provide most of the implementation), 7 (assume gcd), 13. Ch. 5 –6, (which of the following methods outperforms the others and why) –3,5,7,11,17, 24, 26, 27 (like prove the sum(i = 1, n) 2*i = n(n+1), use induction)

Practice Questions Ch 6 –2,3 –worst, best, average cases for sorts Ch 9 –Self-check problems are about inheritance –5 Ch10 –5,6,7 –We’ve discussed many of the odd probs.

Practice Questions Ch 12: –All the self-check problems –1, 7, 9, 11 (see the relation to C++), 12 (see this in the heap idea later, though it’s exponential storage), 20, 21 is a good thought problem to practice for the final. Ch 13: –3,5 –1,2,3,4,6,10,11 Ch 14: –We did the self-check problems in class –1,2,3,11

Practice Questions Ch 15: –1,2,4,5,6,7 –1,3, 4, 5 (answer may come as explanation in the test) Ch 16: –1,2,4 –1 and 2 (just the adjacency matrix)