(1.2) Which of the following data structures is more appropriate as an implementation of the queue ADT: singly linked list or doubly linked list?
|
|
- Daniel Crawford
- 7 years ago
- Views:
Transcription
1 QUESTION 1 (25 marks) Short answer questions you do not need to provide any justifications for your answers. Just fill in your answer in the space provided. For each correct answer, 1 mark will be awarded. (1.1) True or false: Testing can never be used to prove that a program is correct. (1.2) Which of the following data structures is more appropriate as an implementation of the queue ADT: singly linked list or doubly linked list? Answer: singly linked list (1.3) True or false: Prim s algorithm is asymptotically faster than Dijkstra s algorithm when running on connected graphs. (1.4) True or false: The worst-case running time of selection sort, when applied to an array that is already sorted, is in Θ(n). (1.5) True or false: In divide-and-conquer algorithms, a global optimization problem is solved by making a sequence of local greedy choices. (1.6) True or false: Breadth-first search algorithm works on both cyclic and acyclic graphs. Answer: true 3 of 15
2 (1.7) True or false: Dijkstra s algorithm discussed in class does not work correctly if some edge weights are negative. Answer: true (1.8) Using the most accurate asymptotic notation, give the worst-case running time of randomized partitioning (in quick sort) on an input array of length n. Answer: Θ(n) (1.9) Using asymptotic notation, give the worst-case running time of testing whether two vertices are neighbors in a graph G = (V, E) if the graph is implemented with adjacency lists. Answer: Θ( V ) (1.10) True or false: Compared to worst-case analysis, amortized analysis provides a more accurate upper bound on the performance of an algorithm. (1.11) Is black box testing a type of dynamic or static testing? Answer: dynamic testing (1.12) True or false: In some exceptional cases a loop invariant for a while loop may not be true before the first execution of the loop. (1.13) Using asymptotic notation, what is the memory space required to represent a graph G = (V, E) using an adjacency-list? Answer: Θ( V + E ) 4 of 15
3 (1.14) Consider an undirected connected acyclic graph G that has n vertices. How many spanning trees can be identified in G? Answer: one (1.15) Consider a graph G = (V, E). Let deg(v) denote the degree of vertex v V. What is the result of expression v V deg(v) in terms of E and V? Answer: 2 E (1.16) True or false: Every connected graph has a unique predecessor subgraph. (1.17) A telephone company plans to connect its switching centers together using fiber optics. When connecting switching centers, it is required to have a path between every pair of them. The telephone company is looking for an interconnection topology that minimizes the amount of fiber required to connect its switching centers. Which algorithm discussed in class can be used to help the telephone company find the optimal topology? Answer: Prim s Algorithm Minimum Spanning Tree (1.18) An array A is used to implement a binary heap of size n. Give the left child of the heap element stored in location i of the array. Answer: 2i + 1 null if 2i + 1 n 1 (1.19) Which type of hash table is susceptible to primary clustering: hash table with open addressing or hash table with chaining? Answer: hash table with open addressing 5 of 15
4 (1.20) Which of the following data structures is more appropriate as an implementation of the priority queue ADT: linked list, stack or heap? Answer: heap (1.21) (5 marks) Consider functions f (n) and g(n) as given below. Use the most precise asymptotic notation to show how function f is related to function g in each case (i.e., f?(g)). For example, if you were given the pair of functions f (n) = n and g(n) = n 2 then the correct answer would be: f o(g). To avoid any ambiguity between O(g) and o(g) notations due to writing, use Big-O(g) instead of O(g). f (n) g(n) Relation n 3 + 2n n3 + n log n f Θ(g) 2 n n 1000 f ω(g) log 2 n log 3 n f Θ(g) 2 n 3 n f o(g) 0.5 n 1 f o(g) 6 of 15
5 QUESTION 2 (7 marks) The following questions deal with binary search trees. (2.1) (4 marks) Give pseudocode for a recursive algorithm that searches for a given key in a binary search tree. If the key is found in the tree, your algorithm should return the value associated with that key; otherwise it should throw a NotFoundException exception. The following definitions are assumed: public class BST<E,V> { protected bstnode<e,v> root; protected class bstnode<e,v> { E key; V value; bstnode<e,v> left; bstnode<e,v> right; } } public V search(e key) throws NotFoundException {return search(root, E);} private V search(bstnode<e,v> T, E key) throws NotFoundException; where, you are being asked to complete the following recursive function: V search(bstnode<e,v> T, E key) throws NotFoundException { V search(bstnode<e,v> T, E key) throws NotFoundException { if (T == null) throw new NotFoundException(); else if (key.compareto(t.key) == 0) return T.value; else if (key.compareto(t.key) < 0) return search(t.left, key); else return search(t.right, key); } 7 of 15
6 (2.2) (3 marks) Let T(h) denote the number of steps used to search in a binary search tree of height h in the worst case. Then there are positive constants c 1 and c 2 such that c 1 if h = 1 T(h) (1) c 2 + T(h 1) if h 0 Use this relation to prove (via mathematical induction) that T(h) c 2 ( h + 1 ) + c 1 (2) (a) Base Case: h = 1 = T( 1) c 1 (b) Inductive Step: assume that for h = 1,, k. Prove that T(h) c 2 ( h + 1 ) + c 1 T(k + 1) c 2 ( k + 2 ) + c 1 Since k + 1 0, using (1), we have T(k + 1) c 2 + T(k) Using (2) for T(k), it is obtained that This completes the proof. T(k + 1) c 2 + T(k) c 2 + c 2 (k + 1) + c 1 = c 2 (k + 2) + c 1 8 of 15
7 QUESTION 3 (16 marks) The following questions deal with sorting algorithms. (3.1) (5 marks) Consider the merge operation used in mergesort. Give an algorithm using pseudocode that merges two ordered linked lists L 1 and L 2 into one ordered linked list L and returns the combined list. Your algorithm must run in time O(n). The following definitions are assumed: public class List<E> { } public bool isempty(); // returns true if empty; otherwise false public E head(); // returns the head element, but does not remove it public void insert(e e); // inserts `e' at the tail of the list public E delete(); // returns and removes the head element where, you are being asked to complete the following recursive function: List<E> merge(list<e> L 1, List<E> L 2 ) { List<E> merge(list<e> L1, List<E> L2) { L = create an empty list; while (!L1.isEmpty() and!l2.isempty()) { if (L1.head() <= L2.head()) L.insert(L1.delete()); else L.insert(L2.delete()); } while (!L1.isEmpty()) L.insert(L1.delete()); } while (!L2.isEmpty()) L.insert(L2.delete()); 9 of 15
8 (3.2) (4 marks) Using asymptotic notation, describe the running time of the following algorithms to sort an array of length n. Provide answers for two cases: (i) the input array is sorted in the correct order ( sorted array ), and (ii) the input array contains n copies of the same value ( duplicate array ). sorting algorithm sorted array duplicate array insertionsort Θ(n) Θ(n) mergesort Θ(n log n) Θ(n log n) heapsort Θ(n log n) Θ(n) quicksort Θ(n 2 ) Θ(n 2 ) (3.3) (7 marks) Consider the deterministic partitioning operation used in deterministic quick sort. We modify the partitioning algorithm so that it always partition an input array of length n to two partitions in such a way that the length of the left partition is n K and the length of the right partition is K 1 (for some constant K > 0). Let us refer to this partitioning algorithm as KPartition. Next, consider the following variation of the quick sort algorithm called KQuickSort: KQuickSort(int[] A, int low, int high) n = high low + 1 if n < K then insertionsort(a, low, high) else q = KPartition(A, low, high) KQuickSort(A, low, q-1) // sort the left partition of length n K insertionsort(a, q+1, high) // sort the right partition of length K 1 end if (a) (3 marks) Let T(n) denote the worst-case number of steps to run KQuickSort on input arrays of size n. Complete the following recurrence relation for T(n). Assume that KPartition takes Θ(n) steps to partition an array of size n. c 1 n < K, T(n) c 2 + c 3 n + T(n K) n K for some constants c 1, c 2, c 3 > of 15
9 (b) (2 marks) Use the substitution technique to find an upper bound on T(n). For simplicity, assume that n is a multiple of K, i.e., n = m K (m 0 is an integer). You may find the following relation useful: n + (n K) + (n 2K) + + K = m (n + K) 2 For n K: T(n) c 2 + c 3 n + T(n K). c 2 + c 3 n + [c 2 + c 3 (n K) + T(n 2K)] = 2c 2 + c 3 [n + (n K)] + T(n 2K) 2c 2 + c 3 [n + (n K)] + [c 2 + c 3 (n 2K) + T(n 3K)] = 3C 2 + c 3 [n + (n K) + (n 2K)] + T(n 3K) mc 2 + c 3 [n + (n K) + (n 2K) + + K] + T(0) = mc 2 + c m(n + K) + c 1 = c 2 K n + c 3 2K n(n + K) + c 1 (c) (1 mark) Using the Big-O notation, give an asymptotic expression for the worst-case running time of KQuickSort (no proof is required). O(n 2 ) (d) (1 mark) How does the worst-case asymptotic running time of KQuickSort compares with that of quicksort? Both have the same worst-case running time O(n 2 ). 11 of 15
10 QUESTION 4 (12 marks) The following questions deal with graphs and their algorithms. (4.1) (4 marks) Recall that the depth-first search algorithm presented in class assumes an adjacencylist representation of the input graph. We modify the algorithm to work with an adjacencymatrix representation of the input graph. The modified algorithm is presented below in which the for loop in DFS-Vist has been modified to iterate over the adjacency matrix Adj. The rest of the algorithm remains intact. DFS(G = (V, E), s) 1: for each vertex u V do 2: colour[u] = white 3: π[u] = NIL 4: end for 5: DFS-Visit(s) 6: return π DFS-Visit(u) 1: colour[u] = grey 2: for each vertex v V do 3: if Adj[u, v] == 1 and colour[v] == white then 4: π[v] = u 5: DFS-Visit(v) 6: end if 7: end for 8: colour[u] = black (a) (2 marks) What is the worst-case asymptotic running time of the modified DFS algorithm on a graph G = (V, E)? Briefly justify your answer. i. initialization: Θ( V ) ii. no. of calls to DFS-Visit: Θ( V ) iii. no. of steps in each call of DFS-Visit: Θ( V ) Therefore, the total running time is in Θ( V 2 ) (b) (2 marks) How does the worst-case asymptotic running time of the modified DFS compare with that of the unmodified DFS presented in class? Briefly explain. The worst-case running time of unmodified algorithm is in Θ( V + E ). In general, E < V 2. Thus, the modified algorithm is always slower. Specifically, for dense graphs where E = O( V 2 ), both algorithms have the same asymptotic running time. However, for sparse graphs where E = O( V ), the unmodified version is asymptotically faster. 12 of 15
11 (4.2) (4 marks) Consider the following directed graph and assume that the neighbors of any vertex are always accessed in their respective alphabetical order by label. b e a d g c f (a) (2 marks) Give the final contents of the array π (i.e., the predecessor function) after running depth-first search on this graph, using vertex a as the source. Draw the resulting depth-first tree. b e a d g a b c d e f g π a f e b e f c f (b) (2 marks) Give the final contents of the array d (i.e., the distance function) after running breadth-first search on this graph, using vertex a as the source. Draw the resulting breadth-first tree. b e a d g a b c d e f g d c f 13 of 15
12 (4.3) (4 marks) Consider the following weighted undirected graph and assume that the neighbors of any vertex are always accessed in their respective alphabetical order by label. 3 a 2 c b f e 3 d 4 (a) (2 marks) Draw the shortest-paths tree produced by running the Dijkstra s algorithm on this graph, using vertex a as the source. 3 a 2 c b 1 1 f e 3 d (b) (2 marks) Draw the minimum-cost spanning tree produced by running the Prim s algorithm on this graph, using vertex a as the source. a 2 c b f e 3 d 14 of 15
13 extra page 15 of 15
CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.
Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure
More informationExam study sheet for CS2711. List of topics
Exam study sheet for CS2711 Here is the list of topics you need to know for the final exam. For each data structure listed below, make sure you can do the following: 1. Give an example of this data structure
More informationData Structures and Algorithms Written Examination
Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where
More informationKrishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C
Tutorial#1 Q 1:- Explain the terms data, elementary item, entity, primary key, domain, attribute and information? Also give examples in support of your answer? Q 2:- What is a Data Type? Differentiate
More information2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]
Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)
More information1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++
Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The
More informationQuestions 1 through 25 are worth 2 points each. Choose one best answer for each.
Questions 1 through 25 are worth 2 points each. Choose one best answer for each. 1. For the singly linked list implementation of the queue, where are the enqueues and dequeues performed? c a. Enqueue in
More informationSample Questions Csci 1112 A. Bellaachia
Sample Questions Csci 1112 A. Bellaachia Important Series : o S( N) 1 2 N N i N(1 N) / 2 i 1 o Sum of squares: N 2 N( N 1)(2N 1) N i for large N i 1 6 o Sum of exponents: N k 1 k N i for large N and k
More informationThe Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)!
The Tower of Hanoi Recursion Solution recursion recursion recursion Recursive Thinking: ignore everything but the bottom disk. 1 2 Recursive Function Time Complexity Hanoi (n, src, dest, temp): If (n >
More informationIntroduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1.
Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Quiz 1 Quiz 1 Do not open this quiz booklet until you are directed
More informationData Structure [Question Bank]
Unit I (Analysis of Algorithms) 1. What are algorithms and how they are useful? 2. Describe the factor on best algorithms depends on? 3. Differentiate: Correct & Incorrect Algorithms? 4. Write short note:
More informationBinary Heap Algorithms
CS Data Structures and Algorithms Lecture Slides Wednesday, April 5, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005 2009 Glenn G. Chappell
More informationSorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)
Sorting revisited How did we use a binary search tree to sort an array of elements? Tree Sort Algorithm Given: An array of elements to sort 1. Build a binary search tree out of the elements 2. Traverse
More information5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.
1. The advantage of.. is that they solve the problem if sequential storage representation. But disadvantage in that is they are sequential lists. [A] Lists [B] Linked Lists [A] Trees [A] Queues 2. The
More informationSocial Media Mining. Graph Essentials
Graph Essentials Graph Basics Measures Graph and Essentials Metrics 2 2 Nodes and Edges A network is a graph nodes, actors, or vertices (plural of vertex) Connections, edges or ties Edge Node Measures
More informationClass Overview. CSE 326: Data Structures. Goals. Goals. Data Structures. Goals. Introduction
Class Overview CSE 326: Data Structures Introduction Introduction to many of the basic data structures used in computer software Understand the data structures Analyze the algorithms that use them Know
More informationHome Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit
Data Structures Page 1 of 24 A.1. Arrays (Vectors) n-element vector start address + ielementsize 0 +1 +2 +3 +4... +n-1 start address continuous memory block static, if size is known at compile time dynamic,
More informationThe Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,
The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, cheapest first, we had to determine whether its two endpoints
More informationConverting a Number from Decimal to Binary
Converting a Number from Decimal to Binary Convert nonnegative integer in decimal format (base 10) into equivalent binary number (base 2) Rightmost bit of x Remainder of x after division by two Recursive
More informationAbstract Data Type. EECS 281: Data Structures and Algorithms. The Foundation: Data Structures and Abstract Data Types
EECS 281: Data Structures and Algorithms The Foundation: Data Structures and Abstract Data Types Computer science is the science of abstraction. Abstract Data Type Abstraction of a data structure on that
More informationSymbol Tables. Introduction
Symbol Tables Introduction A compiler needs to collect and use information about the names appearing in the source program. This information is entered into a data structure called a symbol table. The
More informationAnalysis of Algorithms, I
Analysis of Algorithms, I CSOR W4231.002 Eleni Drinea Computer Science Department Columbia University Thursday, February 26, 2015 Outline 1 Recap 2 Representing graphs 3 Breadth-first search (BFS) 4 Applications
More informationBinary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R
Binary Search Trees A Generic Tree Nodes in a binary search tree ( B-S-T) are of the form P parent Key A Satellite data L R B C D E F G H I J The B-S-T has a root node which is the only node whose parent
More informationData Structures Fibonacci Heaps, Amortized Analysis
Chapter 4 Data Structures Fibonacci Heaps, Amortized Analysis Algorithm Theory WS 2012/13 Fabian Kuhn Fibonacci Heaps Lacy merge variant of binomial heaps: Do not merge trees as long as possible Structure:
More informationV. Adamchik 1. Graph Theory. Victor Adamchik. Fall of 2005
V. Adamchik 1 Graph Theory Victor Adamchik Fall of 2005 Plan 1. Basic Vocabulary 2. Regular graph 3. Connectivity 4. Representing Graphs Introduction A.Aho and J.Ulman acknowledge that Fundamentally, computer
More informationIE 680 Special Topics in Production Systems: Networks, Routing and Logistics*
IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* Rakesh Nagi Department of Industrial Engineering University at Buffalo (SUNY) *Lecture notes from Network Flows by Ahuja, Magnanti
More informationPES Institute of Technology-BSC QUESTION BANK
PES Institute of Technology-BSC Faculty: Mrs. R.Bharathi CS35: Data Structures Using C QUESTION BANK UNIT I -BASIC CONCEPTS 1. What is an ADT? Briefly explain the categories that classify the functions
More informationOrdered Lists and Binary Trees
Data Structures and Algorithms Ordered Lists and Binary Trees Chris Brooks Department of Computer Science University of San Francisco Department of Computer Science University of San Francisco p.1/62 6-0:
More informationSequential Data Structures
Sequential Data Structures In this lecture we introduce the basic data structures for storing sequences of objects. These data structures are based on arrays and linked lists, which you met in first year
More informationCompSci-61B, Data Structures Final Exam
Your Name: CompSci-61B, Data Structures Final Exam Your 8-digit Student ID: Your CS61B Class Account Login: This is a final test for mastery of the material covered in our labs, lectures, and readings.
More informationTo My Parents -Laxmi and Modaiah. To My Family Members. To My Friends. To IIT Bombay. To All Hard Workers
To My Parents -Laxmi and Modaiah To My Family Members To My Friends To IIT Bombay To All Hard Workers Copyright 2010 by CareerMonk.com All rights reserved. Designed by Narasimha Karumanchi Printed in
More informationAlgorithms and Data Structures
Algorithms and Data Structures Part 2: Data Structures PD Dr. rer. nat. habil. Ralf-Peter Mundani Computation in Engineering (CiE) Summer Term 2016 Overview general linked lists stacks queues trees 2 2
More informationCpt S 223. School of EECS, WSU
The Shortest Path Problem 1 Shortest-Path Algorithms Find the shortest path from point A to point B Shortest in time, distance, cost, Numerous applications Map navigation Flight itineraries Circuit wiring
More information1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.
1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D. base address 2. The memory address of fifth element of an array can be calculated
More informationCSC148 Lecture 8. Algorithm Analysis Binary Search Sorting
CSC148 Lecture 8 Algorithm Analysis Binary Search Sorting Algorithm Analysis Recall definition of Big Oh: We say a function f(n) is O(g(n)) if there exists positive constants c,b such that f(n)
More informationWhy? A central concept in Computer Science. Algorithms are ubiquitous.
Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online
More information6 March 2007 1. Array Implementation of Binary Trees
Heaps CSE 0 Winter 00 March 00 1 Array Implementation of Binary Trees Each node v is stored at index i defined as follows: If v is the root, i = 1 The left child of v is in position i The right child of
More informationDATA STRUCTURES USING C
DATA STRUCTURES USING C QUESTION BANK UNIT I 1. Define data. 2. Define Entity. 3. Define information. 4. Define Array. 5. Define data structure. 6. Give any two applications of data structures. 7. Give
More informationData Structures. Chapter 8
Chapter 8 Data Structures Computer has to process lots and lots of data. To systematically process those data efficiently, those data are organized as a whole, appropriate for the application, called a
More informationAnalysis of a Search Algorithm
CSE 326 Lecture 4: Lists and Stacks 1. Agfgd 2. Dgsdsfd 3. Hdffdsf 4. Sdfgsfdg 5. Tefsdgass We will review: Analysis: Searching a sorted array (from last time) List ADT: Insert, Delete, Find, First, Kth,
More informationGRAPH THEORY LECTURE 4: TREES
GRAPH THEORY LECTURE 4: TREES Abstract. 3.1 presents some standard characterizations and properties of trees. 3.2 presents several different types of trees. 3.7 develops a counting method based on a bijection
More informationAlgorithms and data structures
Algorithms and data structures This course will examine various data structures for storing and accessing information together with relationships between the items being stored, and algorithms for efficiently
More informationInternational Journal of Software and Web Sciences (IJSWS) www.iasir.net
International Association of Scientific Innovation and Research (IASIR) (An Association Unifying the Sciences, Engineering, and Applied Research) ISSN (Print): 2279-0063 ISSN (Online): 2279-0071 International
More information6. Standard Algorithms
6. Standard Algorithms The algorithms we will examine perform Searching and Sorting. 6.1 Searching Algorithms Two algorithms will be studied. These are: 6.1.1. inear Search The inear Search The Binary
More informationOutline BST Operations Worst case Average case Balancing AVL Red-black B-trees. Binary Search Trees. Lecturer: Georgy Gimel farb
Binary Search Trees Lecturer: Georgy Gimel farb COMPSCI 220 Algorithms and Data Structures 1 / 27 1 Properties of Binary Search Trees 2 Basic BST operations The worst-case time complexity of BST operations
More informationBinary Heaps * * * * * * * / / \ / \ / \ / \ / \ * * * * * * * * * * * / / \ / \ / / \ / \ * * * * * * * * * *
Binary Heaps A binary heap is another data structure. It implements a priority queue. Priority Queue has the following operations: isempty add (with priority) remove (highest priority) peek (at highest
More informationA binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:
Binary Search Trees 1 The general binary tree shown in the previous chapter is not terribly useful in practice. The chief use of binary trees is for providing rapid access to data (indexing, if you will)
More informationCost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:
CSE341T 08/31/2015 Lecture 3 Cost Model: Work, Span and Parallelism In this lecture, we will look at how one analyze a parallel program written using Cilk Plus. When we analyze the cost of an algorithm
More informationBinary Search Trees CMPSC 122
Binary Search Trees CMPSC 122 Note: This notes packet has significant overlap with the first set of trees notes I do in CMPSC 360, but goes into much greater depth on turning BSTs into pseudocode than
More informationData Structures and Algorithm Analysis (CSC317) Intro/Review of Data Structures Focus on dynamic sets
Data Structures and Algorithm Analysis (CSC317) Intro/Review of Data Structures Focus on dynamic sets We ve been talking a lot about efficiency in computing and run time. But thus far mostly ignoring data
More informationEfficiency of algorithms. Algorithms. Efficiency of algorithms. Binary search and linear search. Best, worst and average case.
Algorithms Efficiency of algorithms Computational resources: time and space Best, worst and average case performance How to compare algorithms: machine-independent measure of efficiency Growth rate Complexity
More informationChapter 8: Bags and Sets
Chapter 8: Bags and Sets In the stack and the queue abstractions, the order that elements are placed into the container is important, because the order elements are removed is related to the order in which
More informationEuclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014
Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li Advised by: Dave Mount May 22, 2014 1 INTRODUCTION In this report we consider the implementation of an efficient
More informationCS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team
CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team Lecture Summary In this lecture, we learned about the ADT Priority Queue. A
More informationLecture Notes on Binary Search Trees
Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning André Platzer Lecture 17 October 23, 2014 1 Introduction In this lecture, we will continue considering associative
More informationCS711008Z Algorithm Design and Analysis
CS711008Z Algorithm Design and Analysis Lecture 7 Binary heap, binomial heap, and Fibonacci heap 1 Dongbo Bu Institute of Computing Technology Chinese Academy of Sciences, Beijing, China 1 The slides were
More informationData Structures and Algorithms
Data Structures and Algorithms CS245-2016S-06 Binary Search Trees David Galles Department of Computer Science University of San Francisco 06-0: Ordered List ADT Operations: Insert an element in the list
More informationLecture 1: Course overview, circuits, and formulas
Lecture 1: Course overview, circuits, and formulas Topics in Complexity Theory and Pseudorandomness (Spring 2013) Rutgers University Swastik Kopparty Scribes: John Kim, Ben Lund 1 Course Information Swastik
More informationAny two nodes which are connected by an edge in a graph are called adjacent node.
. iscuss following. Graph graph G consist of a non empty set V called the set of nodes (points, vertices) of the graph, a set which is the set of edges and a mapping from the set of edges to a set of pairs
More informationInternational Journal of Advanced Research in Computer Science and Software Engineering
Volume 3, Issue 7, July 23 ISSN: 2277 28X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Greedy Algorithm:
More informationAnalysis of Algorithms I: Binary Search Trees
Analysis of Algorithms I: Binary Search Trees Xi Chen Columbia University Hash table: A data structure that maintains a subset of keys from a universe set U = {0, 1,..., p 1} and supports all three dictionary
More informationLecture Notes on Binary Search Trees
Lecture Notes on Binary Search Trees 15-122: Principles of Imperative Computation Frank Pfenning Lecture 17 March 17, 2010 1 Introduction In the previous two lectures we have seen how to exploit the structure
More informationCS473 - Algorithms I
CS473 - Algorithms I Lecture 9 Sorting in Linear Time View in slide-show mode 1 How Fast Can We Sort? The algorithms we have seen so far: Based on comparison of elements We only care about the relative
More informationNow is the time. For all good men PERMUTATION GENERATION. Princeton University. Robert Sedgewick METHODS
Now is the time For all good men PERMUTATION GENERATION METHODS To come to the aid Of their party Robert Sedgewick Princeton University Motivation PROBLEM Generate all N! permutations of N elements Q:
More informationTHIS CHAPTER studies several important methods for sorting lists, both contiguous
Sorting 8 THIS CHAPTER studies several important methods for sorting lists, both contiguous lists and linked lists. At the same time, we shall develop further tools that help with the analysis of algorithms
More informationMinimum Spanning Trees
Minimum Spanning Trees weighted graph API cycles and cuts Kruskal s algorithm Prim s algorithm advanced topics References: Algorithms in Java, Chapter 20 http://www.cs.princeton.edu/introalgsds/54mst 1
More informationIntroduction to Data Structures and Algorithms
Introduction to Data Structures and Algorithms Chapter: Elementary Data Structures(1) Lehrstuhl Informatik 7 (Prof. Dr.-Ing. Reinhard German) Martensstraße 3, 91058 Erlangen Overview on simple data structures
More informationBicolored Shortest Paths in Graphs with Applications to Network Overlay Design
Bicolored Shortest Paths in Graphs with Applications to Network Overlay Design Hongsik Choi and Hyeong-Ah Choi Department of Electrical Engineering and Computer Science George Washington University Washington,
More informationCS5310 Algorithms 3 credit hours 2 hours lecture and 2 hours recitation every week
CS5310 Algorithms 3 credit hours 2 hours lecture and 2 hours recitation every week This course is a continuation of the study of data structures and algorithms, emphasizing methods useful in practice.
More informationAlgorithms and Data Structures
Algorithms and Data Structures CMPSC 465 LECTURES 20-21 Priority Queues and Binary Heaps Adam Smith S. Raskhodnikova and A. Smith. Based on slides by C. Leiserson and E. Demaine. 1 Trees Rooted Tree: collection
More informationGENERATING THE FIBONACCI CHAIN IN O(log n) SPACE AND O(n) TIME J. Patera
ˆ ˆŠ Œ ˆ ˆ Œ ƒ Ÿ 2002.. 33.. 7 Š 539.12.01 GENERATING THE FIBONACCI CHAIN IN O(log n) SPACE AND O(n) TIME J. Patera Department of Mathematics, Faculty of Nuclear Science and Physical Engineering, Czech
More information5. Binary objects labeling
Image Processing - Laboratory 5: Binary objects labeling 1 5. Binary objects labeling 5.1. Introduction In this laboratory an object labeling algorithm which allows you to label distinct objects from a
More informationSimplified External memory Algorithms for Planar DAGs. July 2004
Simplified External Memory Algorithms for Planar DAGs Lars Arge Duke University Laura Toma Bowdoin College July 2004 Graph Problems Graph G = (V, E) with V vertices and E edges DAG: directed acyclic graph
More informationFrom Last Time: Remove (Delete) Operation
CSE 32 Lecture : More on Search Trees Today s Topics: Lazy Operations Run Time Analysis of Binary Search Tree Operations Balanced Search Trees AVL Trees and Rotations Covered in Chapter of the text From
More informationScheduling Shop Scheduling. Tim Nieberg
Scheduling Shop Scheduling Tim Nieberg Shop models: General Introduction Remark: Consider non preemptive problems with regular objectives Notation Shop Problems: m machines, n jobs 1,..., n operations
More informationAlgorithms Chapter 12 Binary Search Trees
Algorithms Chapter 1 Binary Search Trees Outline Assistant Professor: Ching Chi Lin 林 清 池 助 理 教 授 chingchi.lin@gmail.com Department of Computer Science and Engineering National Taiwan Ocean University
More informationAlgorithms. Margaret M. Fleck. 18 October 2010
Algorithms Margaret M. Fleck 18 October 2010 These notes cover how to analyze the running time of algorithms (sections 3.1, 3.3, 4.4, and 7.1 of Rosen). 1 Introduction The main reason for studying big-o
More informationChapter 14 The Binary Search Tree
Chapter 14 The Binary Search Tree In Chapter 5 we discussed the binary search algorithm, which depends on a sorted vector. Although the binary search, being in O(lg(n)), is very efficient, inserting a
More informationRotation Operation for Binary Search Trees Idea:
Rotation Operation for Binary Search Trees Idea: Change a few pointers at a particular place in the tree so that one subtree becomes less deep in exchange for another one becoming deeper. A sequence of
More informationPersistent Binary Search Trees
Persistent Binary Search Trees Datastructures, UvA. May 30, 2008 0440949, Andreas van Cranenburgh Abstract A persistent binary tree allows access to all previous versions of the tree. This paper presents
More informationJava Software Structures
INTERNATIONAL EDITION Java Software Structures Designing and Using Data Structures FOURTH EDITION John Lewis Joseph Chase This page is intentionally left blank. Java Software Structures,International Edition
More informationZachary Monaco Georgia College Olympic Coloring: Go For The Gold
Zachary Monaco Georgia College Olympic Coloring: Go For The Gold Coloring the vertices or edges of a graph leads to a variety of interesting applications in graph theory These applications include various
More informationMathematics for Algorithm and System Analysis
Mathematics for Algorithm and System Analysis for students of computer and computational science Edward A. Bender S. Gill Williamson c Edward A. Bender & S. Gill Williamson 2005. All rights reserved. Preface
More informationDynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction
Lecture 11 Dynamic Programming 11.1 Overview Dynamic Programming is a powerful technique that allows one to solve many different types of problems in time O(n 2 ) or O(n 3 ) for which a naive approach
More informationFinding and counting given length cycles
Finding and counting given length cycles Noga Alon Raphael Yuster Uri Zwick Abstract We present an assortment of methods for finding and counting simple cycles of a given length in directed and undirected
More informationHeaps & Priority Queues in the C++ STL 2-3 Trees
Heaps & Priority Queues in the C++ STL 2-3 Trees CS 3 Data Structures and Algorithms Lecture Slides Friday, April 7, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks
More informationApproximation Algorithms
Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms
More informationLecture 6: Binary Search Trees CSCI 700 - Algorithms I. Andrew Rosenberg
Lecture 6: Binary Search Trees CSCI 700 - Algorithms I Andrew Rosenberg Last Time Linear Time Sorting Counting Sort Radix Sort Bucket Sort Today Binary Search Trees Data Structures Data structure is a
More informationPart 2: Community Detection
Chapter 8: Graph Data Part 2: Community Detection Based on Leskovec, Rajaraman, Ullman 2014: Mining of Massive Datasets Big Data Management and Analytics Outline Community Detection - Social networks -
More informationFast Sequential Summation Algorithms Using Augmented Data Structures
Fast Sequential Summation Algorithms Using Augmented Data Structures Vadim Stadnik vadim.stadnik@gmail.com Abstract This paper provides an introduction to the design of augmented data structures that offer
More informationLoad balancing Static Load Balancing
Chapter 7 Load Balancing and Termination Detection Load balancing used to distribute computations fairly across processors in order to obtain the highest possible execution speed. Termination detection
More informationAP Computer Science AB Syllabus 1
AP Computer Science AB Syllabus 1 Course Resources Java Software Solutions for AP Computer Science, J. Lewis, W. Loftus, and C. Cocking, First Edition, 2004, Prentice Hall. Video: Sorting Out Sorting,
More informationCourse: Programming II - Abstract Data Types. The ADT Stack. A stack. The ADT Stack and Recursion Slide Number 1
Definition Course: Programming II - Abstract Data Types The ADT Stack The ADT Stack is a linear sequence of an arbitrary number of items, together with access procedures. The access procedures permit insertions
More informationLecture Notes on Linear Search
Lecture Notes on Linear Search 15-122: Principles of Imperative Computation Frank Pfenning Lecture 5 January 29, 2013 1 Introduction One of the fundamental and recurring problems in computer science is
More informationDATABASE DESIGN - 1DL400
DATABASE DESIGN - 1DL400 Spring 2015 A course on modern database systems!! http://www.it.uu.se/research/group/udbl/kurser/dbii_vt15/ Kjell Orsborn! Uppsala Database Laboratory! Department of Information
More informationWhat Is Recursion? Recursion. Binary search example postponed to end of lecture
Recursion Binary search example postponed to end of lecture What Is Recursion? Recursive call A method call in which the method being called is the same as the one making the call Direct recursion Recursion
More informationOutline 2.1 Graph Isomorphism 2.2 Automorphisms and Symmetry 2.3 Subgraphs, part 1
GRAPH THEORY LECTURE STRUCTURE AND REPRESENTATION PART A Abstract. Chapter focuses on the question of when two graphs are to be regarded as the same, on symmetries, and on subgraphs.. discusses the concept
More informationINDISTINGUISHABILITY OF ABSOLUTELY CONTINUOUS AND SINGULAR DISTRIBUTIONS
INDISTINGUISHABILITY OF ABSOLUTELY CONTINUOUS AND SINGULAR DISTRIBUTIONS STEVEN P. LALLEY AND ANDREW NOBEL Abstract. It is shown that there are no consistent decision rules for the hypothesis testing problem
More informationPseudo code Tutorial and Exercises Teacher s Version
Pseudo code Tutorial and Exercises Teacher s Version Pseudo-code is an informal way to express the design of a computer program or an algorithm in 1.45. The aim is to get the idea quickly and also easy
More information