Final Exam Review COP4530.

Slides:



Advertisements
Similar presentations
Transform and Conquer Chapter 6. Transform and Conquer Solve problem by transforming into: a more convenient instance of the same problem (instance simplification)
Advertisements

1 abstract containers hierarchical (1 to many) graph (many to many) first ith last sequence/linear (1 to 1) set.
Binary Trees, Binary Search Trees CMPS 2133 Spring 2008.
Binary Trees, Binary Search Trees COMP171 Fall 2006.
CS 171: Introduction to Computer Science II
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
Lec 15 April 9 Topics: l binary Trees l expression trees Binary Search Trees (Chapter 5 of text)
Course Review COMP171 Spring Hashing / Slide 2 Elementary Data Structures * Linked lists n Types: singular, doubly, circular n Operations: insert,
© 2006 Pearson Addison-Wesley. All rights reserved11 A-1 Chapter 11 Trees.
Transforming Infix to Postfix
1 abstract containers hierarchical (1 to many) graph (many to many) first ith last sequence/linear (1 to 1) set.
1 Hash Tables  a hash table is an array of size Tsize  has index positions 0.. Tsize-1  two types of hash tables  open hash table  array element type.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Review Midterm.
CS 3610 Midterm Review.
CS Data Structures Chapter 5 Trees. Chapter 5 Trees: Outline  Introduction  Representation Of Trees  Binary Trees  Binary Tree Traversals 
Information and Computer Sciences University of Hawaii, Manoa
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Review Midterm.
1 Road Map Associative Container Impl. Unordered ACs Hashing Collision Resolution Collision Resolution Open Addressing Open Addressing Separate Chaining.
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,
Binary Trees, Binary Search Trees RIZWAN REHMAN CENTRE FOR COMPUTER STUDIES DIBRUGARH UNIVERSITY.
Review for Final Andy Wang Data Structures, Algorithms, and Generic Programming.
Trees, Binary Trees, and Binary Search Trees COMP171.
Recursive Data Structures and Grammars  Themes  Recursive Description of Data Structures  Grammars and Parsing  Recursive Definitions of Properties.
Final Exam Review CS Total Points – 60 Points Writing Programs – 50 Points Tracing Algorithms, determining results, and drawing pictures – 50.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 223 – Advanced Data Structures Course Review Final.
Review for Final Exam – cs411/511 Definitions (5 questions, 2 points each) Algorithm Analysis (3 questions, 3 points each) General Questions (3 questions,
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
CISC220 Fall 2009 James Atlas Dec 07: Final Exam Review.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
C++ Review STL CONTAINERS.
CSCI 383 Object-Oriented Programming & Design Lecture 25 Martin van Bommel.
 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.
Final Exam Review CS Total Points – 20 Points Writing Programs – 65 Points Tracing Algorithms, determining results, and drawing pictures – 50.
Week 15 – Monday.  What did we talk about last time?  Tries.
Final Exam Review CS 3358.
CSCE 210 Data Structures and Algorithms
Data Structure By Amee Trivedi.
Introduction to Computers Computer Generations
Trees Chapter 15.
Binary Tree ADT: Properties
COMP 53 – Week Fourteen Trees.
Trees Chapter 11 (continued)
Trees Chapter 11 (continued)
DATA STRUCTURES AND OBJECT ORIENTED PROGRAMMING IN C++
Exam Hints.
Final Review.
Week 15 – Monday CS221.
Lecture 18. Basics and types of Trees
Week 11 - Friday CS221.
Hashing Exercises.
abstract containers sequence/linear (1 to 1) hierarchical (1 to many)
Cse 373 April 26th – Exam Review.
November 1st – Exam Review
Review for Final Exam Non-cumulative, covers material since exam 2
i206: Lecture 13: Recursion, continued Trees
Binary Trees, Binary Search Trees
Review for Midterm Neil Tang 03/04/2010
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.
Prof. Michael Neary Lecture 7: The STL Prof. Michael Neary
CSE 326: Data Structures: Midterm Review
Review for Exam 1 Topics covered: For each of these data structures
Trees 1: Theory, Models, Generic Heap Algorithms, Priority Queues
Final Exam Review COP4530.
ITEC 2620M Introduction to Data Structures
Binary Trees, Binary Search Trees
Advanced Implementation of Tables
Final Review Dr. Yingwu Zhu.
EE 312 Final Exam Review.
Important Problem Types and Fundamental Data Structures
Binary Trees, Binary Search Trees
Presentation transcript:

Final Exam Review COP4530

A high-level summary of what we learned Algorithm analysis Data structures Vector, List, Deque STL sequence containers Stack, Queue, Priority queues STL adaptor containers Set and map (multiset, multimap) Hashing tables (unordered_set, unordered_map) STL associative containers Trees set and map in STL implemented using binary search tree Graphs (not covered) Available in Boost Algorithms Various algorithms associated with data structures Various sorting algorithms DFS/BFS, infix to postfix conversion, postfix evaluation Graph algorithms (not covered)

f(n) is asymptotically Big “O” Notation f(n) =O(g(n)) If and only if there exist two constants c > 0 and n0 > 0, such that f(n) < cg(n) for all n >= n0 iff  c, n0 > 0 | 0 < f(n) < cg(n)  n >= n0 cg(n) f(n) f(n) is asymptotically upper bounded by g(n) n0

f(n) is asymptotically Big “Omega” Notation f(n) = (g(n)) iff  c, n0 > 0 | 0 < cg(n) < f(n)  n >= n0 f(n) cg(n) f(n) is asymptotically lower bounded by g(n) n0

Big “Theta” Notation f(n) = (g(n)) c2g(n) f(n) f(n) has the iff  c1, c2, n0 > 0 | 0 < c1g(n) < f(n) < c2g(n)  n >= n0 c2g(n) f(n) f(n) has the same long-term rate of growth as g(n) c1g(n) n0

C++ Standard Template Library (STL) Template based Generic programming One definition works for all types (proper type) Containers – data structures vector, list, deque, priority_queue, set, map, unordered_set, unordered_map, … Algorithms Sorting algorithms, and many others Iterators – to access elements of the containers Encapsulating difference among distinct data structures Common interface for generic algorithms

Generic programming basics How to write template classes Also template function Iterators Const Iterators Unidirectional vs. bidirectional iterators

STL Container implementation Data members (member variables) Constructors Destructor Methods Iterators Overloaded operators The Big five – copy and move assignment operators, copy and move constructors, destructor

Basic STL Containers Vector List Familiarity Similar to array in operation Index-referenced elements (random element access) RESIZABLE First-class objects List Linked list – one element points to next one Singly/Doubly linked list STL List implemented as DOUBLY LINKED STL forward_list is singly linked Familiarity Use of basic operations Implementation of each container

Double Ended Queues Deque Operations on a Deque How is it different from Vector? Deque Implementation Using a circular array Locating the front and the back positions of the deque Calculating the size of the deque Accessing the ith element in the deque How a deque should be implemented if we maintain an explicit size member variable? In particular, member functions front, push_front, pop_front

Stack ADT Basic Operations Implementation Common uses of Stack First In, Last Out Implementation Using an Adaptor Class Common uses of Stack Depth first search Evaluation of postfix expressions Conversion from infix to postfix expressions Matching brackets Function calls Recursion

Queue ADT Basic operations Implementation Common uses of Queue First In, First Out Implementation Using an Adaptor Class Common uses of Queue Breadth first search Buffers Simulations Producer-Consumer Problems

Depth First Search How does it work How to use stack for conducting DFS DFS algorithm implementation

Breadth First Search How does it work How to use queues for conducting BFS BFS algorithm implementation

Positional Containers Definition? Examples? Also called sequential containers in STL terms

Trees – Basic Theory Definitions Tree, Rooted Tree Depth/Height of Vertex Depth/Height of Tree. Descending Path Parent, Child, Sibling, Ancestor, Descendant Root, Leaf

Tree Implementation Structure of a node Linking the children and siblings with constant space for a Node.

Generic Tree traversals Preorder traversal Postorder traversal Levelorder traversal Inorder traversal for binary trees

Binary trees Definition Structure representation Complete Binary Tree Structure representation Relation between number of nodes n and height H of a complete binary tree Levelorder traversal How to compute the height of a tree? Vector representation of a complete binary tree

Binary Search Tree Not the same as a binary tree Also known as Totally Ordered Tree Finding an element Finding the smallest element Finding the largest element Search complexity Best case, Worst case, Average case BST implementation Recursive implementation of tree operations such as insert and delete

BST Anomalies Why BST may not necessarily be balanced? Insertion of element In sorted order Or even mostly sorted order Deletion Bias Why does it arise? Simple ways to overcome the bias.

AVL trees Definition of AVL trees Implementation of AVL trees Building AVL trees by inserting/deleting elements

M-ary Trees Definition Implementation Usefulness? M-ary tree Complete M-ary tree Implementation Usefulness?

M-ary Search Trees Not the same as M-ary Trees Representation Search process

B-Trees B = Balanced Conditions for M-ary tree to be called a B-tree Inserting a value Inserting at a non-full leaf Inserting at a full leaf When to split a non-leaf node When to split the root Deletion Combining leaves, non-leaves Borrowing leaves from neighborhood When does the height of the tree grow? Reduce?

Associative Containers Generic Associative Containers Unimodal vs. Multimodal associative containers Sets Regular set vs. Multi-set Maps Regular maps vs. Multi-maps

Hash Tables Basic principles of using hash tables Designing a hash table Choosing a Hash Function Conflict Resolution Strategy Hash functions Properties of a good hash function

Conflict Resolution Strategies Separate Chaining Linear Probing Quadratic Probing Double Hashing Rehashing

Priority Queue What is it? When is it useful? Operations Push, pop, top, clear, empty Implementation Adaptor class: can use linked lists, Binary Search Trees, B-Trees, Heaps

Heaps Notion of partially ordered trees Heap = partially ordered complete binary tree Vector representation of Heap Implementing different operations Push heap Pop heap Build heap Given a sequence of numbers, building a heap Insertion and deletion

Sorting Different sorting techniques Bubble sort Insertion sort Algorithm details Best-case, worst-case and average case complexity of each Especially for the recursive algorithms Bubble sort Insertion sort Shell sort Heap sort Merge sort Quick sort Pivoting strategy Partitioning strategy Recursion

Graph algorithms Representations of Graphs Topological sorting Shortest-path algorithms Unweighted version Weighted version