Additional Divide and Conquer Algorithms. Skipping from chapter 4: Quicksort Binary Search Binary Tree Traversal Matrix Multiplication

Size: px
Start display at page:

Download "Additional Divide and Conquer Algorithms. Skipping from chapter 4: Quicksort Binary Search Binary Tree Traversal Matrix Multiplication"

Transcription

1 Aitional Divie an Conquer Algorithms Skipping from chapter 4: Quicksort Binary Search Binary Tree Traversal Matrix Multiplication Divie an Conquer Closest Pair Let s revisit the closest pair problem. Last time we looke at a brute force solution that ran in O(n 2 ) time. Let P 1 = (x 1, y 1 ), P n = (x n, y n ) be a set S of n points in the plane, where n, for simplicity is a power of two. We can sort these points in ascening orer of their x coorinate using a O(nlgn) sorting algorithm such as mergesort. Next we ivie the points into two subsets S 1 an S 2 where each have n/2 points by rawing a line through the meian of all points. We can fin the meian in O(n) time. This is shown below: S 1 S 2 Next, we recursively fin the closest pairs for the left subset S 1 an for the right subset S 2. If the set consists of just two points, then there is only one solution (that connects those two points). Let 1 an 2 be the smallest istances between pairs of points in S 1 an S 2 as shown below: 1 2

2 Let = the minimum of ( 1 an 2 ). This is not necessarily our answer, because the shortest istance between points might connect a pair of points on opposite sies of the line. Consequently, we must compare to the pairs that cross the line. We can limit our attention to points in the symmetrical vertical strip of with 2 since the istance between any other pair of points is greater than : 1 2 For every point between the left ashe line an the symmetrical line in the mile we must inspect the istance to points on the right sie of the line to the right ashe line. However, we only nee to look at those points that are within a istance of from the current point. The key here is that there can be no more than six such points because any pair of points in the right half is at least apart from each other. The worst case is shown below: If we maintain an aitional list of the points sorte by y coorinate then we can limit the points we examine to +/- in both the x an y irection for these borer points. To perform the step of comparing istances between points on both sies of the line requires O(n) runtime. For each of up to n points we have a constant number (up to 6) of other points to examine. This process is similar to the merge time require for MergeSort. We then compare the smallest of these istances to, an choose the smallest istance as the solution to the problem.

3 Our total runtime is then: T(n) = 2T(n/2) + O(n) Time to split in half plus line comparison We can solve this using a variety of methos as O(nlgn). This is the best we can o as an efficiency class, since it has been proven that this problem is Ω(nlgn). Divie an Conquer Convex Hull Problem Earlier we saw a brute force O(n 3 ) algorithm to fin the convex hull. Let s look at an expecte O(nlgn) algorithm calle QuickHull that is somewhat similar to Quicksort. Once again, we have a set of points P locate in a 2D plane. First, sort the points in increasing orer of their x coorinate. This can be one in O(nlgn) time. It shoul be obvious that the leftmost point P 1 an the rightmost point P n must belong to the set s convex hull. Let P 1 P n be the line rawn from P 1 to P n. This line separates P into two sets, S 1 to the left of the line, an S 2 to the right of the line. (left is counter clockwise when connecting the points). S 1 constitutes the bounary of the upper convex hull an S 2 the bounary of the lower convex hull: S 1 P n P 1 S 2 If we re lucky, the line exactly separates the points in half, so half are in S 1 an half are in S 2. In the worst case, all other points are in S 1 or S 2. If there is some ranomness the on general we can expect to cut the problem close to in half as we repeat the process. Next we ll fin the convex hull for S 1. We can repeat the same exact process to solve S 2. To fin the convex hull for S 1, we fin the point in S 1 that is farthest from the line segment P 1 P n. Let s say this point is P max. If we examine the line segment from P 1 to P max then we can recursively repeat the algorithm for all points to the left of this line (The set S 11 in the iagram below). Similarly, if we examine the line segment from P n to P max then we can recursively repeat the algorithm for all points to the right of this line (The set S 12 in the iagram below). All points insie the triangle can be iscare, since they are in the triangle an can t be part of the convex hull.

4 P max S 12 S 1 P n S 11 P 1 S 2 If we try to fin the points in the convex hull for a set with only one point, then that point must be in the set. At this point we have etermine the upper convex hull: S 12 S 1 P n P 1 S 2 If we repeat the process on the lower convex hull we will complete the problem an fin all of the points for the entire convex hull. For an animate applet that illustrates this algorithm, see: What is the runtime? Let s say that we always split the set of points in half each time we raw the line segment from P 1 to P n. This means we split the problem up into two subproblems of size n/2. Fining the most istant point from the line segment takes O(n) time. This leas to our familiar recurrence relation of: T(n) = 2T(n/2) + O(n) which is O(nlgn).

5 Decrease an Conquer The ecrease an conquer technique is similar to ivie an conquer, except instea of partitioning a problem into multiple subproblems of smaller size, we use some technique to reuce our problem into a single problem that is smaller than the original. The smaller problem might be: Decrease by some constant Decrease by some constant factor Variable ecrease Decrease an conquer is also referre to as inuctive or incremental approach. Here are some examples of Decrease an Conquer algorithms: Decrease by one: Insertion sort Graph search algorithms: DFS BFS Topological sorting Algorithms for generating permutations, subsets Decrease by a constant factor Binary search Fake-coin problems Josephus problem Variable-size ecrease Eucli s algorithm : gc(m,n) = gc(n, m mo n) Selection by partition Review of Basic Graph Algorithms A graph is compose of eges E an vertices V that link the noes together. A graph G is often enote G=(V,E) where V is the set of vertices an E the set of eges. Two types of graphs: 1. Directe graphs: G=(V,E) where E is compose of orere pairs of vertices; i.e. the eges have irection an point from one vertex to another. 2. Unirecte graphs: G=(V,E) where E is compose of unorere pairs of vertices; i.e. the eges are biirectional.

6 Directe Graph: Unirecte Graph: The egree of a vertex in an unirecte graph is the number of eges that leave/enter the vertex. The egree of a vertex in a irecte graph is the same,but we istinguish between in-egree an out-egree. Degree = in-egree + out-egree. The running time of a graph algorithm expresse in terms of E an V, where E = E an V= V ; e.g. G=O(EV) is E * V We can implement a graph in three ways: 1. Ajacency List 2. Ajacency-Matrix 3. Pointers/memory for each noe (actually a form of ajacency list) Using an Ajacency List: List of pointers for each vertex A 1 2 3

7 A The sum of the lengths of the ajacency lists is 2 E in an unirecte graph, an E in a irecte graph. The amount of memory to store the array for the ajacency list is O(max(V,E))=O(V+E).

8 Using an Ajacency Matrix: When is using an ajacency matrix a goo iea? A ba iea? The matrix always uses Θ( v 2 ) memory. Usually easier to implement an perform lookup than an ajacency list. Sparse graph: very few eges. Dense graph: lots of eges. Up to O(v 2 ) eges if fully connecte. The ajacency matrix is a goo way to represent a weighte graph. In a weighte graph, the eges have weights associate with them. Upate matrix entry to contain the weight. Weights coul inicate istance, cost, etc. Search: The goal is to methoically explore every vertex an every ege; perhaps to o some processing on each. Will assume ajacency-list representation of the input graph.

9 Breath-First-Search (BFS) : Example 1: Binary Tree. This is a special case of a graph. The orer of search is across levels. The root is examine first; then both chilren of the root; then the chilren of those noes, etc Sometimes we can stop the algorithm if we are looking for a particular element, but the general BFS algorithm runs through every noe. Example 2: irecte graph: 1. Pick a source vertex S to start. 2. Fin (or iscover) the vertices that are ajacent to S. 3. Pick each chil of S in turn an iscover their vertices ajacent to that chil. 4. Done when all chilren have been iscovere an examine. This results in a tree that is roote at the source vertex S. The iea is to fin the istance from some Source vertex by expaning the frontier of what we have visite. Pseuocoe: Uses FIFO Queue Q BFS(s) ; s is our source vertex for each u V - {s} ; Initialize unvisite vertices to o [u] [s] 0 ; istance to source vertex is 0 Q {s} ; Queue of vertices to visit while Q<>0 o remove u from Q for each v Aj[u] o ; Get ajacent vertices if [v]= then [v] [u]+1 ; Increment epth put v onto Q ; A to noes to explore

10 Example: (this is the final state, start with 0 an infinity as values) a b 2 c f 2 e i 3 g 3 3 h Initially, [a] is set to 0 an the rest to. Q [a]. Remove hea: Q [] chilren of a are c,b [c]=, [b]= so [c] [a]+1=1, [b] [a]+1=1 Q [c b] Remove hea: Q [b] chilren of c are e,f [e]=, [f]= so [e] [c]+1=2, [f] [c]+1=2 Q [b e f] Remove hea: Q [e f] chilren of b is f [f] <>, nothing one with it Remove hea: Q [f] chilren of e is, i, h []=, [i]=, [h]= so [] [i] [h] [e]+1=3 Q [f i h] Remove hea: Q [ i h] chilren of is g [g]=, so [g] []+1 = 3 Q [ i h g] Each of these has chilren that are alreay has a value less than, so these will not set any further values an we are one with the BFS. Can create a tree out of the orer we visit the noes:

11 a 0 b c 1 e f 2 h i g 3 Memory require: Nee to maintain Q, which contains a list of all fringe vertices we nee to explore. Runtime: O(V+E) ; O(E) to scan through ajacency list an O(V) to visit each vertex. This is consiere linear time in the size of G. Claim: BFS always computes the shortest path istance in [I] between S an vertex I. We will skip the proof for now. What if some noes are unreachable from the source? (reverse c-e,f-h eges). What values o these noes get? Depth First Search: Another metho to search graphs. Example 1: DFS on binary tree. Specialize case of more general graph. The orer of the search is own paths an from left to right. The root is examine first; then the left chil of the root; then the left chil of this noe, etc. until a leaf is foun. At a leaf, backtrack to the lowest right chil an repeat Example 2: DFS on irecte graph. 1. Start at some source vertex S. 2. Fin (or explore) the first vertex that is ajacent to S. 3. Repeat with this vertex an explore the first vertex that is ajacent to it.

12 Pseuocoe: 4. When a vertex is foun that has no unexplore vertices ajacent to it then backtrack up one level 5. Done when all chilren have been iscovere an examine. Results in a forest of trees. DFS(s) for each vertex u V o color[u] White time 1 for each vertex u V o if color[u]=white then DFS-Visit(u,time) DFS-Visit(u,time) color[u] Gray [u] time time time+1 for each v Aj[u] o if color[u]=white then DFS-Visit(v,time) color[u] Black f[u] time time+1 ; not visite ; time stamp ; in progress noes ; =iscover time ; f=finish time Example: 1/18 a 2/17 10/11 b 5/6 c 3/16 f e 9/14 12/13 i g 4/7 8/15 h Numbers are Discover/Finish times. We coul have ifferent visit times epening on which eges we pick to traverse uring the DFS. The tree built by this search looks like:

13 a c f g h b e i What if some noes are unreachable? We still visit those noes in DFS. Consier if c-e, f-h links were reverse. Then we en up with two separate trees: 1/10 a 2/9 11/12 b 5/6 c 3/8 f e 13/18 15/16 i g 4/7 14/17 h Still visit all vertices an get a forest: a set of unconnecte graphs without cycles (a tree is a connecte graph without cycles). Time for DFS: O(V 2 ) - DFS loop goes O(V) times once for each vertex (can t be more than once, because a vertex oes not stay white), an the loop over Aj runs up to V times. But The for loop in DFS-Visit looks at every element in Aj once. It is charge once per ege for a irecte graph, or twice if unirecte. A small part of Aj is looke at uring each recursive call but over the entire time the for loop is execute only the same number of times as the size of the ajacency list which is Θ (E). Since the initial loop takes Θ (V) time, the total runtime is Θ (V+E). This is consiere linear in terms of the size of the input ajacency-list representation. So if there are lots of eges then E ominates the runtime, otherwise V oes.

14 Note: Don t have to track the backtracking/fringe as in BFS since this is one for us in the recursive calls an the stack. The stack makes the noes orere LIFO. The amount of storage neee is linear in terms of the epth of the tree. Types of Eges: There are 4 types. DFS can be moifie to classify eges as being of the correct type: 1. Tree Ege: An ege in a epth-first forest. Ege(u,v) is a tree ege if v was first iscovere from u. 2. Back Ege: An ege that connects some vertex to an ancestor in a epth-first tree. Self-loops are back eges. 3. Forwar Ege: An ege that connects some vertex to a escenant in a epth-first tree. 4. Cross Ege: Any other ege. DAG s Nothing to o with sheep! A DAG is a Directe Acyclic Graph. This is a irecte graph that contains no cycles. Examples: a c e b f A irecte graph D is acyclic iff a DFS of G yiels no back eges. Proof: Trivial. Acyclic means no back ege because a back ege makes a cycle. Suppose we have a back ege (u,v). Then v is an ancestor of u in the epth-first forest. But then there is alreay a path from v to u an the back ege makes a cycle. Suppose G has a cycle c. But then DFS of G will have a back ege. Let v be the first vertex in c foun by DFS an let u be a vertex in c that is connecte back to v. Then

15 when DFS expans the chilren of u, the vertex v is foun. Since v is an ancestor of u the ege (u,v) is a back ege. v u Topological Sort of a ag A topological sort of a ag is an orering of all the vertices of G so that if (u,v) is an ege then u is liste (sorte) before v. This is a ifferent notion of sorting than we are use to. a,b,f,e,,c an f,a,e,b,,c are both topological sorts of the above ag. There may be multiple sorts; this is okay since a is not relate to f, either vertex can come first. Main use: Inicate orer of events, what shoul happen first Algorithm for Topological-Sort: 1. Call DFS(G) to compute f(v), the finish time for each vertex. 2. As each vertex is finishe insert it onto the front of the list. 3. Return the list. Time is Θ (V+E), time for DFS. Example: Pizza irecte graph 1/12 sauce 2/3 bake 4/5 cheese 6/11 sausage 7/10 8/9 oregano olives crust 13/14 DFS: Start with sauce. The numbers inicate start/finish time. We insert into the list in reverse orer of finish time. Crust, Sauce, Sausage, Olives, Oregano, Cheese, Bake

16 Why oes this work? Because we on t have any back eges in a ag, so we won t return to process a parent until after processing the chilren. We can orer by finish times because a vertex that finishes earlier will be epenent on a vertex that finishes later.

Graduate Algorithms CS F-15 Graphs, BFS, & DFS

Graduate Algorithms CS F-15 Graphs, BFS, & DFS Grauate Algorithms CS67-206F-5 Graphs, BFS, & DFS Davi Galles Department o Computer Science University o San Francisco 5-0: Graphs A graph consists o: A set o noes or vertices (terms are interchangeable)

More information

Introduction to Algorithms A graph G =(V, E) V = set of vertices E = set of edges

Introduction to Algorithms A graph G =(V, E) V = set of vertices E = set of edges Introuction to Algorithms A graph G =(V, E) V = set of vertices E = set of eges In an unirecte graph: ege(u, v) = ege(v, u) Chapter 22: Elementary Graph Algorithms In a irecte graph: ege(u,v) goes from

More information

Pairwise alignment using shortest path algorithms, Gunnar Klau, November 29, 2005, 11:

Pairwise alignment using shortest path algorithms, Gunnar Klau, November 29, 2005, 11: airwise alignment using shortest path algorithms, Gunnar Klau, November 9,, : 3 3 airwise alignment using shortest path algorithms e will iscuss: it graph Dijkstra s algorithm algorithm (GDU) 3. References

More information

Divide-and-Conquer Algorithms

Divide-and-Conquer Algorithms Supplment to A Practical Guie to Data Structures an Algorithms Using Java Divie-an-Conquer Algorithms Sally A Golman an Kenneth J Golman Hanout Divie-an-conquer algorithms use the following three phases:

More information

Graph Representation

Graph Representation Graph Representation Adjacency list representation of G = (V, E) An array of V lists, one for each vertex in V Each list Adj[u] contains all the vertices v such that there is an edge between u and v Adj[u]

More information

CS350 - Exam 4 (100 Points)

CS350 - Exam 4 (100 Points) Fall 0 Name CS0 - Exam (00 Points).(0 points) Re-Black Trees For the Re-Black tree below, inicate where insert() woul initially occur before rebalancing/recoloring. Sketch the tree at ALL intermeiate steps

More information

Elementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph:

Elementary Graph Algorithms. Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. Representing a graph: Graph G(V, E): V set of nodes (vertices); E set of edges. Notation: n = V and m = E. (Vertices are numbered

More information

Representations of Graphs

Representations of Graphs ELEMENTARY GRAPH ALGORITHMS -- CS-5321 Presentation -- I am Nishit Kapadia Representations of Graphs There are two standard ways: A collection of adjacency lists - they provide a compact way to represent

More information

Graph: representation and traversal

Graph: representation and traversal Graph: representation and traversal CISC4080, Computer Algorithms CIS, Fordham Univ. Instructor: X. Zhang! Acknowledgement The set of slides have use materials from the following resources Slides for textbook

More information

CSI 604 Elementary Graph Algorithms

CSI 604 Elementary Graph Algorithms CSI 604 Elementary Graph Algorithms Ref: Chapter 22 of the text by Cormen et al. (Second edition) 1 / 25 Graphs: Basic Definitions Undirected Graph G(V, E): V is set of nodes (or vertices) and E is the

More information

22.3 Depth First Search

22.3 Depth First Search 22.3 Depth First Search Depth-First Search(DFS) always visits a neighbour of the most recently visited vertex with an unvisited neighbour. This means the search moves forward when possible, and only backtracks

More information

CS Data Structures and Algorithm Analysis

CS Data Structures and Algorithm Analysis CS 483 - Data Structures and Algorithm Analysis Lecture VI: Chapter 5, part 2; Chapter 6, part 1 R. Paul Wiegand George Mason University, Department of Computer Science March 8, 2006 Outline 1 Topological

More information

Graph Algorithms. Definition

Graph Algorithms. Definition Graph Algorithms Many problems in CS can be modeled as graph problems. Algorithms for solving graph problems are fundamental to the field of algorithm design. Definition A graph G = (V, E) consists of

More information

Uninformed search methods

Uninformed search methods CS 1571 Introuction to AI Lecture 4 Uninforme search methos Milos Hauskrecht milos@cs.pitt.eu 539 Sennott Square Announcements Homework assignment 1 is out Due on Thursay, September 11, 014 before the

More information

Divide-and-Conquer. The most-well known algorithm design strategy: smaller instances. combining these solutions

Divide-and-Conquer. The most-well known algorithm design strategy: smaller instances. combining these solutions Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances recursively 3. Obtain solution to original

More information

W4231: Analysis of Algorithms

W4231: Analysis of Algorithms W4231: Analysis of Algorithms 10/21/1999 Definitions for graphs Breadth First Search and Depth First Search Topological Sort. Graphs AgraphG is given by a set of vertices V and a set of edges E. Normally

More information

Graphs. Graph G = (V, E) Types of graphs E = O( V 2 ) V = set of vertices E = set of edges (V V)

Graphs. Graph G = (V, E) Types of graphs E = O( V 2 ) V = set of vertices E = set of edges (V V) Graph Algorithms Graphs Graph G = (V, E) V = set of vertices E = set of edges (V V) Types of graphs Undirected: edge (u, v) = (v, u); for all v, (v, v) E (No self loops.) Directed: (u, v) is edge from

More information

Principles of B-trees

Principles of B-trees CSE465, Fall 2009 February 25 1 Principles of B-trees Noes an binary search Anoe u has size size(u), keys k 1,..., k size(u) 1 chilren c 1,...,c size(u). Binary search property: for i = 1,..., size(u)

More information

Scribes: Romil Verma, Juliana Cook (2015), Virginia Williams, Date: May 1, 2017 and Seth Hildick-Smith (2016), G. Valiant (2017), M.

Scribes: Romil Verma, Juliana Cook (2015), Virginia Williams, Date: May 1, 2017 and Seth Hildick-Smith (2016), G. Valiant (2017), M. Lecture 9 Graphs Scribes: Romil Verma, Juliana Cook (2015), Virginia Williams, Date: May 1, 2017 and Seth Hildick-Smith (2016), G. Valiant (2017), M. Wootters (2017) 1 Graphs A graph is a set of vertices

More information

CS 310 Advanced Data Structures and Algorithms

CS 310 Advanced Data Structures and Algorithms CS 31 Advanced Data Structures and Algorithms Graphs July 18, 17 Tong Wang UMass Boston CS 31 July 18, 17 1 / 4 Graph Definitions Graph a mathematical construction that describes objects and relations

More information

Minimum Spanning Trees Ch 23 Traversing graphs

Minimum Spanning Trees Ch 23 Traversing graphs Next: Graph Algorithms Graphs Ch 22 Graph representations adjacency list adjacency matrix Minimum Spanning Trees Ch 23 Traversing graphs Breadth-First Search Depth-First Search 11/30/17 CSE 3101 1 Graphs

More information

COT 6405 Introduction to Theory of Algorithms

COT 6405 Introduction to Theory of Algorithms COT 6405 Introduction to Theory of Algorithms Topic 14. Graph Algorithms 11/7/2016 1 Elementary Graph Algorithms How to represent a graph? Adjacency lists Adjacency matrix How to search a graph? Breadth-first

More information

Review: Graph Theory and Representation

Review: Graph Theory and Representation Review: Graph Theory and Representation Graph Algorithms Graphs and Theorems about Graphs Graph implementation Graph Algorithms Shortest paths Minimum spanning tree What can graphs model? Cost of wiring

More information

Graphs. CSE 2320 Algorithms and Data Structures Alexandra Stefan and Vassilis Athitsos University of Texas at Arlington

Graphs. CSE 2320 Algorithms and Data Structures Alexandra Stefan and Vassilis Athitsos University of Texas at Arlington Graphs CSE 2320 Algorithms and Data Structures Alexandra Stefan and Vassilis Athitsos University of Texas at Arlington 1 Representation Adjacency matrix??adjacency lists?? Review Graphs (from CSE 2315)

More information

3.1 Basic Definitions and Applications

3.1 Basic Definitions and Applications Graphs hapter hapter Graphs. Basic efinitions and Applications Graph. G = (V, ) n V = nodes. n = edges between pairs of nodes. n aptures pairwise relationship between objects: Undirected graph represents

More information

Acknowledgement. Flow Graph Theory. Depth First Search. Speeding up DFA 8/16/2016

Acknowledgement. Flow Graph Theory. Depth First Search. Speeding up DFA 8/16/2016 8/6/06 Program Analysis https://www.cse.iitb.ac.in/~karkare/cs68/ Flow Graph Theory Acknowlegement Slies base on the material at http://infolab.stanfor.eu/~ullman/ragon/ w06/w06.html Amey Karkare Dept

More information

Chapter 4. Divide-and-Conquer. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Chapter 4. Divide-and-Conquer. Copyright 2007 Pearson Addison-Wesley. All rights reserved. Chapter 4 Divide-and-Conquer Copyright 2007 Pearson Addison-Wesley. All rights reserved. Divide-and-Conquer The most-well known algorithm design strategy: 2. Divide instance of problem into two or more

More information

Graph Algorithms. Andreas Klappenecker. [based on slides by Prof. Welch]

Graph Algorithms. Andreas Klappenecker. [based on slides by Prof. Welch] Graph Algorithms Andreas Klappenecker [based on slides by Prof. Welch] 1 Directed Graphs Let V be a finite set and E a binary relation on V, that is, E VxV. Then the pair G=(V,E) is called a directed graph.

More information

Brute Force: Selection Sort

Brute Force: Selection Sort Brute Force: Intro Brute force means straightforward approach Usually based directly on problem s specs Force refers to computational power Usually not as efficient as elegant solutions Advantages: Applicable

More information

Trees and Graphs Shabsi Walfish NYU - Fundamental Algorithms Summer 2006

Trees and Graphs Shabsi Walfish NYU - Fundamental Algorithms Summer 2006 Trees and Graphs Basic Definitions Tree: Any connected, acyclic graph G = (V,E) E = V -1 n-ary Tree: Tree s/t all vertices of degree n+1 A root has degree n Binary Search Tree: A binary tree such that

More information

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees

Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees Lecture 10. Elementary Graph Algorithm Minimum Spanning Trees T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Design and Analysis of Algorithms CSE 5311 Lecture 18 Graph Algorithm Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 Graphs Graph G = (V,

More information

TIE Graph algorithms

TIE Graph algorithms TIE-20106 239 11 Graph algorithms This chapter discusses the data structure that is a collection of points (called nodes or vertices) and connections between them (called edges or arcs) a graph. The common

More information

Lecture 1 September 4, 2013

Lecture 1 September 4, 2013 CS 84r: Incentives an Information in Networks Fall 013 Prof. Yaron Singer Lecture 1 September 4, 013 Scribe: Bo Waggoner 1 Overview In this course we will try to evelop a mathematical unerstaning for the

More information

Elementary Graph Algorithms

Elementary Graph Algorithms Elementary Graph Algorithms Graphs Graph G = (V, E)» V = set of vertices» E = set of edges (V V) Types of graphs» Undirected: edge (u, v) = (v, u); for all v, (v, v) E (No self loops.)» Directed: (u, v)

More information

Basic Graph Algorithms

Basic Graph Algorithms Basic Graph Algorithms 1 Representations of Graphs There are two standard ways to represent a graph G(V, E) where V is the set of vertices and E is the set of edges. adjacency list representation adjacency

More information

Graph Representations and Traversal

Graph Representations and Traversal COMPSCI 330: Design and Analysis of Algorithms 02/08/2017-02/20/2017 Graph Representations and Traversal Lecturer: Debmalya Panigrahi Scribe: Tianqi Song, Fred Zhang, Tianyu Wang 1 Overview This lecture

More information

Plane Sweep Algorithms

Plane Sweep Algorithms CMPS 6640/4040 Computational Geometry Spring 2016 Plane Sweep Algorithms Carola Wenk 3/3/16 CMPS 6640/4040 Computational Geometry 1 Line Segment Intersection Input: A set S={s 1,, s n } of (close) line

More information

Solutions to relevant spring 2000 exam problems

Solutions to relevant spring 2000 exam problems Problem 2, exam Here s Prim s algorithm, modified slightly to use C syntax. MSTPrim (G, w, r): Q = V[G]; for (each u Q) { key[u] = ; key[r] = 0; π[r] = 0; while (Q not empty) { u = ExtractMin (Q); for

More information

Fundamental Graph Algorithms Part Four

Fundamental Graph Algorithms Part Four Fundamental Graph Algorithms Part Four Announcements Problem Set One due right now. Due Friday at 2:15PM using one late period. Problem Set Two out, due next Friday, July 12 at 2:15PM. Play around with

More information

Graph Algorithms: Chapters Part 1: Introductory graph concepts

Graph Algorithms: Chapters Part 1: Introductory graph concepts UMass Lowell Computer Science 91.503 Algorithms Dr. Haim Levkowitz Fall, 2007 Graph Algorithms: Chapters 22-25 Part 1: Introductory graph concepts 1 91.404 Graph Review Elementary Graph Algorithms Minimum

More information

Practical Session No. 12 Graphs, BFS, DFS Topological Sort

Practical Session No. 12 Graphs, BFS, DFS Topological Sort Practical Session No. 12 Graphs, BFS, DFS Topological Sort Graphs and BFS Graph G = (V, E) Graph Representations (VG ) v1 v n V(G) = V - Set of all vertices in G E(G) = E - Set of all edges (u,v) in G,

More information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer Science & Engineering 423/823 Design and Analysis of Algorithms s of s Computer Science & Engineering 423/823 Design and Analysis of Lecture 03 (Chapter 22) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 29 s of s s are abstract data types that are applicable

More information

COMP 251 Winter 2017 Online quizzes with answers

COMP 251 Winter 2017 Online quizzes with answers COMP 251 Winter 2017 Online quizzes with answers Open Addressing (2) Which of the following assertions are true about open address tables? A. You cannot store more records than the total number of slots

More information

CISC 320 Introduction to Algorithms Fall Lecture 15 Depth First Search

CISC 320 Introduction to Algorithms Fall Lecture 15 Depth First Search IS 320 Introduction to lgorithms all 2014 Lecture 15 epth irst Search 1 Traversing raphs Systematic search of every edge and vertex of graph (directed or undirected) fficiency: each edge is visited no

More information

6.854J / J Advanced Algorithms Fall 2008

6.854J / J Advanced Algorithms Fall 2008 MIT OpenCourseWare http://ocw.mit.eu 6.854J / 18.415J Avance Algorithms Fall 2008 For inormation about citing these materials or our Terms o Use, visit: http://ocw.mit.eu/terms. 18.415/6.854 Avance Algorithms

More information

Practical Session No. 12 Graphs, BFS, DFS, Topological sort

Practical Session No. 12 Graphs, BFS, DFS, Topological sort Practical Session No. 12 Graphs, BFS, DFS, Topological sort Graphs and BFS Graph G = (V, E) Graph Representations (V G ) v1 v n V(G) = V - Set of all vertices in G E(G) = E - Set of all edges (u,v) in

More information

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Divide and Conquer

Computer Science 385 Analysis of Algorithms Siena College Spring Topic Notes: Divide and Conquer Computer Science 385 Analysis of Algorithms Siena College Spring 2011 Topic Notes: Divide and Conquer Divide and-conquer is a very common and very powerful algorithm design technique. The general idea:

More information

Frequent Pattern Mining. Frequent Item Set Mining. Overview. Frequent Item Set Mining: Motivation. Frequent Pattern Mining comprises

Frequent Pattern Mining. Frequent Item Set Mining. Overview. Frequent Item Set Mining: Motivation. Frequent Pattern Mining comprises verview Frequent Pattern Mining comprises Frequent Pattern Mining hristian Borgelt School of omputer Science University of Konstanz Universitätsstraße, Konstanz, Germany christian.borgelt@uni-konstanz.e

More information

CS521 \ Notes for the Final Exam

CS521 \ Notes for the Final Exam CS521 \ Notes for final exam 1 Ariel Stolerman Asymptotic Notations: CS521 \ Notes for the Final Exam Notation Definition Limit Big-O ( ) Small-o ( ) Big- ( ) Small- ( ) Big- ( ) Notes: ( ) ( ) ( ) ( )

More information

MA/CSSE 473 Day 12. Questions? Insertion sort analysis Depth first Search Breadth first Search. (Introduce permutation and subset generation)

MA/CSSE 473 Day 12. Questions? Insertion sort analysis Depth first Search Breadth first Search. (Introduce permutation and subset generation) MA/CSSE 473 Day 12 Interpolation Search Insertion Sort quick review DFS, BFS Topological Sort MA/CSSE 473 Day 12 Questions? Interpolation Search Insertion sort analysis Depth first Search Breadth first

More information

Lecture 3: Graphs and flows

Lecture 3: Graphs and flows Chapter 3 Lecture 3: Graphs and flows Graphs: a useful combinatorial structure. Definitions: graph, directed and undirected graph, edge as ordered pair, path, cycle, connected graph, strongly connected

More information

Outlines: Graphs Part-2

Outlines: Graphs Part-2 Elementary Graph Algorithms PART-2 1 Outlines: Graphs Part-2 Graph Search Methods Breadth-First Search (BFS): BFS Algorithm BFS Example BFS Time Complexity Output of BFS: Shortest Path Breath-First Tree

More information

Announcements. HW3 is graded. Average is 81%

Announcements. HW3 is graded. Average is 81% CSC263 Week 9 Announcements HW3 is graded. Average is 81% Announcements Problem Set 4 is due this Tuesday! Due Tuesday (Nov 17) Recap The Graph ADT definition and data structures BFS gives us single-source

More information

TIE Graph algorithms

TIE Graph algorithms TIE-20106 1 1 Graph algorithms This chapter discusses the data structure that is a collection of points (called nodes or vertices) and connections between them (called edges or arcs) a graph. The common

More information

Jana Kosecka. Red-Black Trees Graph Algorithms. Many slides here are based on E. Demaine, D. Luebke slides

Jana Kosecka. Red-Black Trees Graph Algorithms. Many slides here are based on E. Demaine, D. Luebke slides Jana Kosecka Red-Black Trees Graph Algorithms Many slides here are based on E. Demaine, D. Luebke slides Binary Search Trees (BSTs) are an important data structure for dynamic sets In addition to satellite

More information

Graph Search. Adnan Aziz

Graph Search. Adnan Aziz Graph Search Adnan Aziz Based on CLRS, Ch 22. Recall encountered graphs several weeks ago (CLRS B.4) restricted our attention to definitions, terminology, properties Now we ll see how to perform basic

More information

CSC Design and Analysis of Algorithms

CSC Design and Analysis of Algorithms CSC 8301- Design and Analysis of Algorithms Lecture 6 Divide and Conquer Algorithm Design Technique Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide a problem instance into two

More information

Divide and Conquer. Algorithm Fall Semester

Divide and Conquer. Algorithm Fall Semester Divide and Conquer Algorithm 2014 Fall Semester Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances

More information

Readings and References. Graph Paths. Path. Simple Paths and Cycles. Reading. Other References. CSE Data Structures May 24, 2002

Readings and References. Graph Paths. Path. Simple Paths and Cycles. Reading. Other References. CSE Data Structures May 24, 2002 Reaings an References raph aths CE 7 - Data tructures May, Reaing ection., Data tructures an Algorithm Analysis in C, Weiss Other References ome slies base on: CE by. Wolfman, -May- CE 7 - Data tructures

More information

CSC Design and Analysis of Algorithms. Lecture 6. Divide and Conquer Algorithm Design Technique. Divide-and-Conquer

CSC Design and Analysis of Algorithms. Lecture 6. Divide and Conquer Algorithm Design Technique. Divide-and-Conquer CSC 8301- Design and Analysis of Algorithms Lecture 6 Divide and Conquer Algorithm Design Technique Divide-and-Conquer The most-well known algorithm design strategy: 1. Divide a problem instance into two

More information

LECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS

LECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS Department of Computer Science University of Babylon LECTURE NOTES OF ALGORITHMS: DESIGN TECHNIQUES AND ANALYSIS By Faculty of Science for Women( SCIW), University of Babylon, Iraq Samaher@uobabylon.edu.iq

More information

Basic Graph Algorithms (CLRS B.4-B.5, )

Basic Graph Algorithms (CLRS B.4-B.5, ) Basic Graph Algorithms (CLRS B.-B.,.-.) Basic Graph Definitions A graph G = (V,E) consists of a finite set of vertices V and a finite set of edges E. Directed graphs: E is a set of ordered pairs of vertices

More information

Strongly connected: A directed graph is strongly connected if every pair of vertices are reachable from each other.

Strongly connected: A directed graph is strongly connected if every pair of vertices are reachable from each other. Directed Graph In a directed graph, each edge (u, v) has a direction u v. Thus (u, v) (v, u). Directed graph is useful to model many practical problems (such as one-way road in traffic network, and asymmetric

More information

CSE 331: Introduction to Algorithm Analysis and Design Graphs

CSE 331: Introduction to Algorithm Analysis and Design Graphs CSE 331: Introduction to Algorithm Analysis and Design Graphs 1 Graph Definitions Graph: A graph consists of a set of verticies V and a set of edges E such that: G = (V, E) V = {v 0, v 1,..., v n 1 } E

More information

Graph representation

Graph representation Graph Algorithms 1 Graph representation Given graph G = (V, E). May be either directed or undirected. Two common ways to represent for algorithms: 1. Adjacency lists. 2. Adjacency matrix. When expressing

More information

Chapter 22. Elementary Graph Algorithms

Chapter 22. Elementary Graph Algorithms Graph Algorithms - Spring 2011 Set 7. Lecturer: Huilan Chang Reference: (1) Cormen, Leiserson, Rivest, and Stein, Introduction to Algorithms, 2nd Edition, The MIT Press. (2) Lecture notes from C. Y. Chen

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 4 Graphs Definitions Traversals Adam Smith 9/8/10 Exercise How can you simulate an array with two unbounded stacks and a small amount of memory? (Hint: think of a

More information

1 Shortest Path Problems

1 Shortest Path Problems CS268: Geometric Algorithms Hanout #7 Design an Analysis Original Hanout #18 Stanfor University Tuesay, 25 February 1992 Original Lecture #8: 4 February 1992 Topics: Shortest Path Problems Scribe: Jim

More information

Graph Algorithms. Chapter 22. CPTR 430 Algorithms Graph Algorithms 1

Graph Algorithms. Chapter 22. CPTR 430 Algorithms Graph Algorithms 1 Graph Algorithms Chapter 22 CPTR 430 Algorithms Graph Algorithms Why Study Graph Algorithms? Mathematical graphs seem to be relatively specialized and abstract Why spend so much time and effort on algorithms

More information

Topic 12: Elementary Graph Algorithms

Topic 12: Elementary Graph Algorithms Topic 12: Elementary Graph Algorithms Pierre Flener Lars-enrik Eriksson (version of 2013-02-10) Different kinds of graphs List Tree A B C A B C Directed Acyclic Graph (DAG) D A B C D E Directed Graph (Digraph)

More information

Computer Graphics Inf4/MSc. Computer Graphics. Lecture 6 View Projection Taku Komura

Computer Graphics Inf4/MSc. Computer Graphics. Lecture 6 View Projection Taku Komura Computer Graphics Lecture 6 View Projection Taku Komura 1 Overview 1. View transformation 2. Rasterisation Implementation of viewing. Transform into camera coorinates. Perform projection into view volume

More information

Generalized Edge Coloring for Channel Assignment in Wireless Networks

Generalized Edge Coloring for Channel Assignment in Wireless Networks TR-IIS-05-021 Generalize Ege Coloring for Channel Assignment in Wireless Networks Chun-Chen Hsu, Pangfeng Liu, Da-Wei Wang, Jan-Jan Wu December 2005 Technical Report No. TR-IIS-05-021 http://www.iis.sinica.eu.tw/lib/techreport/tr2005/tr05.html

More information

17/05/2018. Outline. Outline. Divide and Conquer. Control Abstraction for Divide &Conquer. Outline. Module 2: Divide and Conquer

17/05/2018. Outline. Outline. Divide and Conquer. Control Abstraction for Divide &Conquer. Outline. Module 2: Divide and Conquer Module 2: Divide and Conquer Divide and Conquer Control Abstraction for Divide &Conquer 1 Recurrence equation for Divide and Conquer: If the size of problem p is n and the sizes of the k sub problems are

More information

Lecture 3: Art Gallery Problems and Polygon Triangulation

Lecture 3: Art Gallery Problems and Polygon Triangulation EECS 396/496: Computational Geometry Fall 2017 Lecture 3: Art Gallery Problems and Polygon Triangulation Lecturer: Huck Bennett In this lecture, we study the problem of guarding an art gallery (specified

More information

Figure 1: 2D arm. Figure 2: 2D arm with labelled angles

Figure 1: 2D arm. Figure 2: 2D arm with labelled angles 2D Kinematics Consier a robotic arm. We can sen it commans like, move that joint so it bens at an angle θ. Once we ve set each joint, that s all well an goo. More interesting, though, is the question of

More information

CS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics

CS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics CS2223: Algorithms Sorting Algorithms, Heap Sort, Linear-time sort, Median and Order Statistics 1 Sorting 1.1 Problem Statement You are given a sequence of n numbers < a 1, a 2,..., a n >. You need to

More information

Positions, Iterators, Tree Structures and Tree Traversals. Readings - Chapter 7.3, 7.4 and 8

Positions, Iterators, Tree Structures and Tree Traversals. Readings - Chapter 7.3, 7.4 and 8 Positions, Iterators, Tree Structures an Reaings - Chapter 7.3, 7.4 an 8 1 Positional Lists q q q q A position acts as a marker or token within the broaer positional list. A position p is unaffecte by

More information

Advanced algorithms. topological ordering, minimum spanning tree, Union-Find problem. Jiří Vyskočil, Radek Mařík 2012

Advanced algorithms. topological ordering, minimum spanning tree, Union-Find problem. Jiří Vyskočil, Radek Mařík 2012 topological ordering, minimum spanning tree, Union-Find problem Jiří Vyskočil, Radek Mařík 2012 Subgraph subgraph A graph H is a subgraph of a graph G, if the following two inclusions are satisfied: 2

More information

Graph implementations :

Graph implementations : Graphs Graph implementations : The two standard ways of representing a graph G = (V, E) are adjacency-matrices and collections of adjacencylists. The adjacency-lists are ideal for sparse trees those where

More information

Analysis of Algorithms Prof. Karen Daniels

Analysis of Algorithms Prof. Karen Daniels UMass Lowell omputer Science 91.404 nalysis of lgorithms Prof. Karen aniels Spring, 2013 hapter 22: raph lgorithms & rief Introduction to Shortest Paths [Source: ormen et al. textbook except where noted]

More information

DFS & STRONGLY CONNECTED COMPONENTS

DFS & STRONGLY CONNECTED COMPONENTS DFS & STRONGLY CONNECTED COMPONENTS CS 4407 Search Tree Breadth-First Search (BFS) Depth-First Search (DFS) Depth-First Search (DFS) u d[u]: when u is discovered f[u]: when searching adj of u is finished

More information

Unit 2: Algorithmic Graph Theory

Unit 2: Algorithmic Graph Theory Unit 2: Algorithmic Graph Theory Course contents: Introduction to graph theory Basic graph algorithms Reading Chapter 3 Reference: Cormen, Leiserson, and Rivest, Introduction to Algorithms, 2 nd Ed., McGraw

More information

CS 220: Discrete Structures and their Applications. graphs zybooks chapter 10

CS 220: Discrete Structures and their Applications. graphs zybooks chapter 10 CS 220: Discrete Structures and their Applications graphs zybooks chapter 10 directed graphs A collection of vertices and directed edges What can this represent? undirected graphs A collection of vertices

More information

Cut vertices, Cut Edges and Biconnected components. MTL776 Graph algorithms

Cut vertices, Cut Edges and Biconnected components. MTL776 Graph algorithms Cut vertices, Cut Edges and Biconnected components MTL776 Graph algorithms Articulation points, Bridges, Biconnected Components Let G = (V;E) be a connected, undirected graph. An articulation point of

More information

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review

CS 161 Lecture 11 BFS, Dijkstra s algorithm Jessica Su (some parts copied from CLRS) 1 Review 1 Review 1 Something I did not emphasize enough last time is that during the execution of depth-firstsearch, we construct depth-first-search trees. One graph may have multiple depth-firstsearch trees,

More information

CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14

CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14 CS 125 Section #6 Graph Traversal and Linear Programs 10/13/14 1 Depth first search 1.1 The Algorithm Besides breadth first search, which we saw in class in relation to Dijkstra s algorithm, there is one

More information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer Science & Engineering 423/823 Design and Analysis of Algorithms Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 04 Elementary Graph Algorithms (Chapter 22) Stephen Scott (Adapted from Vinodchandran N. Variyam) sscott@cse.unl.edu Introduction

More information

Multidimensional Arrays & Graphs. CMSC 420: Lecture 3

Multidimensional Arrays & Graphs. CMSC 420: Lecture 3 Multidimensional Arrays & Graphs CMSC 420: Lecture 3 Mini-Review Abstract Data Types: List Stack Queue Deque Dictionary Set Implementations: Linked Lists Circularly linked lists Doubly linked lists XOR

More information

Graph Traversal CSCI Algorithms I. Andrew Rosenberg

Graph Traversal CSCI Algorithms I. Andrew Rosenberg Graph Traversal CSCI 700 - Algorithms I Andrew Rosenberg Last Time Introduced Graphs Today Traversing a Graph A shortest path algorithm Example Graph We will use this graph as an example throughout today

More information

Graphs. A graph is a data structure consisting of nodes (or vertices) and edges. An edge is a connection between two nodes

Graphs. A graph is a data structure consisting of nodes (or vertices) and edges. An edge is a connection between two nodes Graphs Graphs A graph is a data structure consisting of nodes (or vertices) and edges An edge is a connection between two nodes A D B E C Nodes: A, B, C, D, E Edges: (A, B), (A, D), (D, E), (E, C) Nodes

More information

Chapter 5. Decrease-and-Conquer. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

Chapter 5. Decrease-and-Conquer. Copyright 2007 Pearson Addison-Wesley. All rights reserved. Chapter 5 Decrease-and-Conquer Copyright 2007 Pearson Addison-Wesley. All rights reserved. Decrease-and-Conquer 1. Reduce problem instance to smaller instance of the same problem 2. Solve smaller instance

More information

Practice Problems for the Final

Practice Problems for the Final ECE-250 Algorithms and Data Structures (Winter 2012) Practice Problems for the Final Disclaimer: Please do keep in mind that this problem set does not reflect the exact topics or the fractions of each

More information

Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed.

Here are a couple of warnings to my students who may be here to get a copy of what happened on a day that you missed. Preface Here are my online notes for my Calculus I course that I teach here at Lamar University. Despite the fact that these are my class notes, they shoul be accessible to anyone wanting to learn Calculus

More information

Problem Paper Atoms Tree. atoms.pas. atoms.cpp. atoms.c. atoms.java. Time limit per test 1 second 1 second 2 seconds. Number of tests

Problem Paper Atoms Tree. atoms.pas. atoms.cpp. atoms.c. atoms.java. Time limit per test 1 second 1 second 2 seconds. Number of tests ! " # %$ & Overview Problem Paper Atoms Tree Shen Tian Harry Wiggins Carl Hultquist Program name paper.exe atoms.exe tree.exe Source name paper.pas atoms.pas tree.pas paper.cpp atoms.cpp tree.cpp paper.c

More information

Copyright 2000, Kevin Wayne 1

Copyright 2000, Kevin Wayne 1 Chapter 3 - Graphs Undirected Graphs Undirected graph. G = (V, E) V = nodes. E = edges between pairs of nodes. Captures pairwise relationship between objects. Graph size parameters: n = V, m = E. Directed

More information

BIJECTIONS FOR PLANAR MAPS WITH BOUNDARIES

BIJECTIONS FOR PLANAR MAPS WITH BOUNDARIES BIJECTIONS FOR PLANAR MAPS WITH BOUNDARIES OLIVIER BERNARDI AND ÉRIC FUSY Abstract. We present bijections for planar maps with bounaries. In particular, we obtain bijections for triangulations an quarangulations

More information

Algorithm classification

Algorithm classification Types of Algorithms Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We ll talk about a classification scheme for algorithms This classification scheme

More information

Proof: if not f[u] < d[v], then u still grey while v is being visited. DFS visit(v) will then terminate before DFS visit(u).

Proof: if not f[u] < d[v], then u still grey while v is being visited. DFS visit(v) will then terminate before DFS visit(u). Parenthesis property of DFS discovery and finishing times (Thm 23.6 of CLR): For any two nodes u,v of a directed graph, if d[u] < d[v] (i.e. u discovered before v), either f[v] < f[u] (i.e. visit time

More information

Preamble. Singly linked lists. Collaboration policy and academic integrity. Getting help

Preamble. Singly linked lists. Collaboration policy and academic integrity. Getting help CS2110 Spring 2016 Assignment A. Linke Lists Due on the CMS by: See the CMS 1 Preamble Linke Lists This assignment begins our iscussions of structures. In this assignment, you will implement a structure

More information