# Nesting of Reducible and Irreducible Loops

Save this PDF as:

Size: px
Start display at page:

## Transcription

1 Nesting of Reducible and Irreducible Loops PAUL HAVLAK Rice University Recognizing and transforming loops are essential steps in any attempt to improve the running time of a program. Aggressive restructuring techniques have been developed for single-entry (reducible) loops, but restructurers and the dataflow and dependence analysis they rely on often give up in the presence of multientry (irreducible) loops. Thus one irreducible loop can prevent the improvement of all loops in a procedure. This article gives an algorithm to build a loop nesting tree for a procedure with arbitrary control flow. The algorithm uses definitions of reducible and irreducible loops which allow either kind of loop to be nested in the other. The tree construction algorithm, an extension of Tarjan s algorithm for testing reducibility, runs in almost linear time. In the presence of irreducible loops, the loop nesting tree can depend on the depth-first spanning tree used to build it. In particular, the header node representing a reducible loop in one version of the loop nesting tree can be the representative of an irreducible loop in another. We give a normalization method that maximizes the set of reducible loops discovered, independent of the depth-first spanning tree used. The normalization requires the insertion of at most one node and one edge per reducible loop. Categories and Subject Descriptors: D.3.4 [Programming Languages]: Processors compilers General Terms: Algorithms, Languages Additional Key Words and Phrases: Strongly-connected regions, reducible loops 1. INTRODUCTION Computer programs do not execute for very long without repeating instructions. To make a program run faster one must find and accelerate the blocks of repetitive code known as loops. Most general-purpose procedural languages have special constructs for representing loops, but most also allow arbitrary transfers of control using GOTOs. Speeding up a program can require identifying loops in arbitrary control-flow graphs. Dealing with messy loops is a problem for many compilers, particularly optimizing compilers for superscalar and parallel computers. Their techniques for aggressively analyzing dependences and restructuring loops commonly focus on handling reducible programs those with only single-entry loops. When reducibility is de- This research was conducted at Rice University and at the University of Maryland and was supported by the NSF and the Center for Research on Parallel Computation through grants ASC and CCR Author s address: Department of Computer Science, Rice University, 6100 South Main Street, Houston, Texas Permission to make digital/hard copy of all or part of this material without fee is granted provided that the copies are not made or distributed for profit or commercial advantage, the ACM copyright/server notice, the title of the publication, and its date appear, and notice is given that copying is by permission of the Association for Computing Machinery, Inc. (ACM). To copy otherwise, to republish, to post on servers, or to redistribute to lists requires prior specific permission and/or a fee. c 1997 ACM /97/ \$03.50 ACM Transactions on Programming Languages and Systems, Vol. 19, No. 4, July 1997, Pages

2 558 Paul Havlak program main : if P goto β: /*... */ γ: if Q goto κ β : if R goto γ γ β γ : goto κ: on I goto β, λ,κ κ κ λ: if S goto λ λ end main Fig. 1. Example code, G CF, and dominator tree. sired, but not enforced by language restrictions, it must be checked [Tarjan 1974]. Any irreducible portions must then be ignored (and therefore not optimized) or repaired by the replication of statements. Repair can cause exponential growth in the number of program statements [Aho et al. 1986]. This article presents methods for isolating the irreducible parts of a program and maximizing the portion that can be handled using reducible-loop techniques. Using traditional notions of reducibility and defining notions of nested reducible and irreducible loops, we show how to build a generalized loop nesting tree, with the procedure analyze loops in Figure 5. For purposes of familiarity and efficiency, we have expressed this algorithm as an adaptation of Tarjan s algorithm for testing reducibility [Tarjan 1974]. Our loop nesting tree is not unique when the single entry of a reducible loop can also be an entry of an irreducible loop. Procedure fix loops in Figure 6 adds null statements in such cases to guarantee that a maximal and unique set of reducible loops will be found by analyze loops. 2. BACKGROUND 2.1 Control-Flow Graphs The control-flow graph G CF =(N CF,E CF ) is a basic tool in the static analysis of programs. Each node n N CF represents a basic block of zero or more executable statements in straight-line sequence, with no control-flow jumps into the block except before the first statement and no jumps out except after the last. Each edge (s, d) E CF represents a potential transfer of control after execution of the last statement in the source node s to the first statement in the destination node d. Figure 1 sketches an example program in pseudocode and gives its control-flow graph G CF (and its dominator tree, described in the next section). The distinguished node has no incoming edges and has outgoing edges to each node

3 Nesting of Reducible and Irreducible Loops 559 static current := 1 number[*] := UNVISITED // arbitrary nil value 0 DFS() procedure DFS(a) node[current] := a // record nodes visited in order number[a] := current++ // record preorder number of this node and advance count foreach node b such that an edge (a, b) do if (number[b] ==UNVISITED) then DFS(b) last[number[a]] := current - 1 // record preorder number of last descendant Fig. 2. Depth-first search. where we can enter a procedure; the distinguished node has no outgoing edges and has incoming edges from every node with a return point. One can view and as standing in for everything external to the current procedure; an extra control-flow edge (, ) represents the possibility that the procedure is not executed. A node with multiple out-edges is a branch; such a node (with the exception of ) contains a final statement that is a conditional jump. A node with multiple in-edges, such as, is a merge. For this article we are not concerned with labels on the different edges leaving a branch or entering a merge. A path in G CF from node a to node b is a sequence of zero or more edges in E CF with the first having a as source, the last having b as destination. There is always a (zero-length) path from a node to itself. 2.2 Dominator Trees The dominance relation records which nodes must be encountered en route to other nodes. A node a dominates anodeb(a b)ifallg CF paths from to b include a. Whenb has multiple dominators, the unique one that occurs after the other dominators on any path to b is b s immediate dominator. Making the immediate dominator of each node its parent in a tree produces a dominator tree, such as that given rightmost in Figure 1. Dominance can be tested quickly using the preorder numbering trick described below for depth-first spanning trees. The dominator tree can be built in almost linear time [Lengauer and Tarjan 1979] The dominator tree can be used directly to find reducible loops; we use this property in fix loops later. For the analysis of irreducible loops, we rely on depthfirst search. 2.3 Depth-First Search A depth-first traversal of a graph visits all the nodes, marking them as they are visited. The next node visited is an unmarked neighbor of the most recently visited node with such a neighbor. If the traversal begins with, and all other nodes are reachable, the edges followed define a depth-first spanning tree (DFST) of G CF. More precisely, depth-first search is implemented as in Figure 2. The nodes are ordered sequentially in the order that each is first visited during the search; the depth-first number of a node a (saved in number[a]) is equivalent to its preorder number on the DFST. By also saving the number of each node s last descendant

5 Nesting of Reducible and Irreducible Loops reducible 3 β irred. β λ 4 γ irred. γ κ self 5 κ 7 reducible 6 λ 8 9 Fig. 3. DFST and loop tree for example reducible 4 γ 9 irred. λ 5 κ irred. γ 6 λ 8 β self κ β 7 Fig. 4. Another DFST and loop tree for example.

6 562 Paul Havlak Given a depth-first spanning tree of G CF,anyedge(v, w) wherewis an ancestor of v in the spanning tree is called a backedge. The destination of a backedge is always a loop header, and each loop header will always have at least one incoming backedge. When only reducible loops are present, our nested loops are equivalent to Tarjan intervals [Tarjan 1974]. The notion of nested reducible and irreducible loops presented here is a refinement of that presented in Havlak [1994] and Sloman et al. [1994]. 2.5 UNION-FIND Both Tarjan s method for testing reducibility and our procedure analyze loops for building arbitrary loop-nesting trees make use of an algorithm for performing a sequence of UNION and FIND operations shown by Tarjan to take almost linear time [Tarjan 1983]. We omit code for the operations, defining only their behavior as used in this article. UNION and FIND are employed on disjoint sets from a universe U of elements m i, each identified by an integer i [1,N]. For our algorithms U = N CF,andiis the DFST preorder number of node m i. Each set s i N CF is also designated by an integer i [1,N]. Initially, s i = {m i }. UNION operates to combine the sets, and FIND gives the set currently containing an element, taking all previous UNIONs into account. In our usage, UNION(x, y) assigns s y equal to s x s y and then makes s x empty. FIND(x) givesysuch that m x s y. 3. BUILDING THE LOOP-NESTING TREE Figure 5 gives our method for computing the headers of reducible and irreducible loops. The main structure of the procedure analyze loops is that of Tarjan s method for testing reducibility, with one major difference. Tarjan s method quits on finding an irreducible loop, but ours marks the loop and continues [Tarjan 1974]. For reducible graphs, the methods are essentially the same. We have kept fairly close to Tarjan s formatting for ease of comparison. The key variables (e.g., w, y,p) have the same names, and the letter labels on statements correspond to the same labels in Tarjan s formulation. Among the modest changes are specifying as the header of outermost loop headers (so the loop-nesting tree will be rooted) and moving the UNION operation for the sake of clarity. In step (a) we first number the nodes of G CF in preorder using depth-first search and save the preorder number of each node s last descendant in the DFST. For the example program in Figure 1, this could produce either of the DFST s shown on the left of Figures 3 and 4 let us proceed using only the DFST from Figure 3. In Tarjan s presentation, step (b) builds lists of backedges and other edges into each node. A backedge comes from a descendant in the DFST and a nonbackedge from a nondescendant. It is sufficient to save only the sources of backedges and other edges separately, which we do in backpreds and nonbackpreds. The backedges, according to Figure 3, are {(κ, κ), (, ), (, γ), (κ, β), (λ, )}. We have also added the initialization of the node types to. The type field for nodes records distinctions that were implicit in Tarjan s work ( vs. self) or absent (reducible vs. irreducible).

9 Nesting of Reducible and Irreducible Loops 565 procedure fix loops(g CF,) number vertices of G CF using depth-first search from, numbering in preorder from 1 to N CF and saving last[*] for w := 1 to N CF do redbackin[w] :=otherin[w]:= foreach edge (v, w) entering wdo if (w v) then add (v, w) toredbackin[w] else add (v, w) tootherin[w] if (redbackin[w] ) and ( otherin[w] > 1) then insert new node w into G CF immediately before w, unnumbered create new edge (w,w) foreach edge (v, w) otherin[w] do delete (v, w) and create otherwise identical edge (v, w ) Fig. 6. Splitting reducible loop headers from irreducible loops. β γ κ λ Fig. 7. G CF for example with inserted nodes. then we will in a sense have maximized the reducible loops. To do this, we must guarantee that no reducible backedge will share a destination with an irreducible backedge (for any DFST). Procedure fix loops in Figure 6 modifies G CF so that any node with incoming reducible backedges has exactly one other incoming edge. Since every reachable node must have a tree edge in the DFST (the edge along which the depth-first search reached the node), there are no other edges left to be irreducible backedges. The result of applying fix loops to our example G CF is given in Figure 7. Node now has one reducible backedge, from, and one other edge, from the new node. All other edges into have been moved to.now stands in as an entry (and possible header) to the irreducible loop.

11 Nesting of Reducible and Irreducible Loops 567 Havlak, P Interprocedural symbolic analysis. Ph.D. thesis, Tech. Rep. CS-TR94-228, Dept. of Computer Science, Rice Univ., Houston, Tex. Lengauer, T. and Tarjan, R. E A fast algorithm for finding dominators in a flowgraph. ACMTrans.Program.Lang.Syst.1, Schwartz, J. and Sharir, M A design for optimizations of the bitvectoring class. Tech. rep., Courant Inst., New York Univ., New York. September. Sloman, B., Lake, T., and William, S Identifying loops in flowgraphs. Tech. Rep. SEG/GN/94/1, Univ. of Reading, Reading, UK. Tarjan, R. E Testing flow graph reducibility. J. Comput. Syst. Sci. 9, Tarjan, R. E Data Structures and Network Algorithms. Society for Industrial and Applied Mathematics, Philadelphia, Pa. Received November 1995; revised August 1996; accepted October 1996

### 12 Abstract Data Types

12 Abstract Data Types 12.1 Source: Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: Define the concept of an abstract data type (ADT).

### Efficient Data Structures for Decision Diagrams

Artificial Intelligence Laboratory Efficient Data Structures for Decision Diagrams Master Thesis Nacereddine Ouaret Professor: Supervisors: Boi Faltings Thomas Léauté Radoslaw Szymanek Contents Introduction...

### 1 2-3 Trees: The Basics

CS10: Data Structures and Object-Oriented Design (Fall 2013) November 1, 2013: 2-3 Trees: Inserting and Deleting Scribes: CS 10 Teaching Team Lecture Summary In this class, we investigated 2-3 Trees in

### 2) Write in detail the issues in the design of code generator.

COMPUTER SCIENCE AND ENGINEERING VI SEM CSE Principles of Compiler Design Unit-IV Question and answers UNIT IV CODE GENERATION 9 Issues in the design of code generator The target machine Runtime Storage

### 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,

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

### Binary 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

### Binary 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

### 10CS35: Data Structures Using C

CS35: Data Structures Using C QUESTION BANK REVIEW OF STRUCTURES AND POINTERS, INTRODUCTION TO SPECIAL FEATURES OF C OBJECTIVE: Learn : Usage of structures, unions - a conventional tool for handling a

### Algorithms 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

### Repetition and Loops. Additional Python constructs that allow us to effect the (1) order and (2) number of times that program statements are executed.

New Topic Repetition and Loops Additional Python constructs that allow us to effect the (1) order and (2) number of times that program statements are executed. These constructs are the 1. while loop and

### Optimizations. Optimization Safety. Optimization Safety. Control Flow Graphs. Code transformations to improve program

Optimizations Code transformations to improve program Mainly: improve execution time Also: reduce program size Control low Graphs Can be done at high level or low level E.g., constant folding Optimizations

### Symbol 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

### Data 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:

### AUTOMATED TEST GENERATION FOR SOFTWARE COMPONENTS

TKK Reports in Information and Computer Science Espoo 2009 TKK-ICS-R26 AUTOMATED TEST GENERATION FOR SOFTWARE COMPONENTS Kari Kähkönen ABTEKNILLINEN KORKEAKOULU TEKNISKA HÖGSKOLAN HELSINKI UNIVERSITY OF

Unordered Linked Lists Derive class unorderedlinkedlist from the abstract class linkedlisttype Implement the operations search, insertfirst, insertlast, deletenode See code on page 292 Defines an unordered

### Data Structure with C

Subject: Data Structure with C Topic : Tree Tree A tree is a set of nodes that either:is empty or has a designated node, called the root, from which hierarchically descend zero or more subtrees, which

### Fast 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

### Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4

Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4 I. Algorithm Design and Divide-and-Conquer There are various strategies we

### S. Muthusundari. Research Scholar, Dept of CSE, Sathyabama University Chennai, India e-mail: nellailath@yahoo.co.in. Dr. R. M.

A Sorting based Algorithm for the Construction of Balanced Search Tree Automatically for smaller elements and with minimum of one Rotation for Greater Elements from BST S. Muthusundari Research Scholar,

### CS104: 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

### Converting 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

### Interprocedural Analysis. CS252r Spring 2011

Interprocedural Analysis CS252r Spring 2011 Procedures So far looked at intraprocedural analysis: analyzing a single procedure Interprocedural analysis uses calling relationships among procedures Enables

### On line construction of suffix trees 1

(To appear in ALGORITHMICA) On line construction of suffix trees 1 Esko Ukkonen Department of Computer Science, University of Helsinki, P. O. Box 26 (Teollisuuskatu 23), FIN 00014 University of Helsinki,

### 1. Sorting (assuming sorting into ascending order) a) BUBBLE SORT

DECISION 1 Revision Notes 1. Sorting (assuming sorting into ascending order) a) BUBBLE SORT Make sure you show comparisons clearly and label each pass First Pass 8 4 3 6 1 4 8 3 6 1 4 3 8 6 1 4 3 6 8 1

### 5. 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

### INDISTINGUISHABILITY 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

### Write Barrier Removal by Static Analysis

Write Barrier Removal by Static Analysis Karen Zee and Martin Rinard Laboratory for Computer Science Massachusetts Institute of Technology Cambridge, MA 02139 {kkz, rinard@lcs.mit.edu ABSTRACT We present

### Exponential time algorithms for graph coloring

Exponential time algorithms for graph coloring Uriel Feige Lecture notes, March 14, 2011 1 Introduction Let [n] denote the set {1,..., k}. A k-labeling of vertices of a graph G(V, E) is a function V [k].

### 1) 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

### Ordered 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:

### Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore

Compiler Design Prof. Y. N. Srikant Department of Computer Science and Automation Indian Institute of Science, Bangalore Module No. # 02 Lecture No. # 05 Run-time Environments-Part 3 and Local Optimizations

### Data Warehousing und Data Mining

Data Warehousing und Data Mining Multidimensionale Indexstrukturen Ulf Leser Wissensmanagement in der Bioinformatik Content of this Lecture Multidimensional Indexing Grid-Files Kd-trees Ulf Leser: Data

### UNIVERSITI MALAYSIA SARAWAK KOTA SAMARAHAN SARAWAK PSD2023 ALGORITHM & DATA STRUCTURE

STUDENT IDENTIFICATION NO UNIVERSITI MALAYSIA SARAWAK 94300 KOTA SAMARAHAN SARAWAK FAKULTI SAINS KOMPUTER & TEKNOLOGI MAKLUMAT (Faculty of Computer Science & Information Technology) Diploma in Multimedia

### The Taxman Game. Robert K. Moniot September 5, 2003

The Taxman Game Robert K. Moniot September 5, 2003 1 Introduction Want to know how to beat the taxman? Legally, that is? Read on, and we will explore this cute little mathematical game. The taxman game

### Data Structures. Jaehyun Park. CS 97SI Stanford University. June 29, 2015

Data Structures Jaehyun Park CS 97SI Stanford University June 29, 2015 Typical Quarter at Stanford void quarter() { while(true) { // no break :( task x = GetNextTask(tasks); process(x); // new tasks may

### 2. Compressing data to reduce the amount of transmitted data (e.g., to save money).

Presentation Layer The presentation layer is concerned with preserving the meaning of information sent across a network. The presentation layer may represent (encode) the data in various ways (e.g., data

### Why have SSA? Birth Points (cont) Birth Points (a notion due to Tarjan)

Why have SSA? Building SSA Form SSA-form Each name is defined exactly once, thus Each use refers to exactly one name x 17-4 What s hard? Straight-line code is trivial Splits in the CFG are trivial x a

### Strategic Deployment in Graphs. 1 Introduction. v 1 = v s. v 2. v 4. e 1. e 5 25. e 3. e 2. e 4

Informatica 39 (25) 237 247 237 Strategic Deployment in Graphs Elmar Langetepe and Andreas Lenerz University of Bonn, Department of Computer Science I, Germany Bernd Brüggemann FKIE, Fraunhofer-Institute,

### NODAL ANALYSIS. Circuits Nodal Analysis 1 M H Miller

NODAL ANALYSIS A branch of an electric circuit is a connection between two points in the circuit. In general a simple wire connection, i.e., a 'short-circuit', is not considered a branch since it is known

### A Note on Maximum Independent Sets in Rectangle Intersection Graphs

A Note on Maximum Independent Sets in Rectangle Intersection Graphs Timothy M. Chan School of Computer Science University of Waterloo Waterloo, Ontario N2L 3G1, Canada tmchan@uwaterloo.ca September 12,

### 2.3 Scheduling jobs on identical parallel machines

2.3 Scheduling jobs on identical parallel machines There are jobs to be processed, and there are identical machines (running in parallel) to which each job may be assigned Each job = 1,,, must be processed

### Petrel TIPS&TRICKS from SCM

Petrel TIPS&TRICKS from SCM Knowledge Worth Sharing Tips for Writing Workflows The Process Manager is the tool used to write workflows. A workflow manages Petrel processes (hence the name), files, graphics,

### Review of Fundamental Mathematics

Review of Fundamental Mathematics As explained in the Preface and in Chapter 1 of your textbook, managerial economics applies microeconomic theory to business decision making. The decision-making tools

### The LCA Problem Revisited

The LA Problem Revisited Michael A. Bender Martín Farach-olton SUNY Stony Brook Rutgers University May 16, 2000 Abstract We present a very simple algorithm for the Least ommon Ancestor problem. We thus

### Introduction to Programming in C++: Algorithms, Flowcharts and Pseudocode

Introduction to Programming in C++: Algorithms, Flowcharts and Pseudocode by Brent Daviduck The following material was developed by Brent Daviduck of the Computer Systems Technology program at Red Deer

### Measuring the Performance of an Agent

25 Measuring the Performance of an Agent The rational agent that we are aiming at should be successful in the task it is performing To assess the success we need to have a performance measure What is rational

### The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).

CHAPTER 5 The Tree Data Model There are many situations in which information has a hierarchical or nested structure like that found in family trees or organization charts. The abstraction that models hierarchical

### GRAPH 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

### AS-2261 M.Sc.(First Semester) Examination-2013 Paper -fourth Subject-Data structure with algorithm

AS-2261 M.Sc.(First Semester) Examination-2013 Paper -fourth Subject-Data structure with algorithm Time: Three Hours] [Maximum Marks: 60 Note Attempts all the questions. All carry equal marks Section A

### Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child

Binary Search Trees Data in each node Larger than the data in its left child Smaller than the data in its right child FIGURE 11-6 Arbitrary binary tree FIGURE 11-7 Binary search tree Data Structures Using

### [2], [3], which realize a time bound of O(n. e(c + 1)).

SIAM J. COMPUT. Vol. 4, No. 1, March 1975 FINDING ALL THE ELEMENTARY CIRCUITS OF A DIRECTED GRAPH* DONALD B. JOHNSON Abstract. An algorithm is presented which finds all the elementary circuits-of a directed

### 2. (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)

### Home 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,

### Data 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:

### IE 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

### TC 2014 Hands on Presentation When Universes Collide: Table Joins in Tableau Guided PDF

TC 2014 Hands on Presentation When Universes Collide: Table Joins in Tableau Guided PDF Introduction - Anatomy of a Table Concepts and vocabulary used in this class Table - A set of values that is organized

### Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection

### 2 SYSTEM DESCRIPTION TECHNIQUES

2 SYSTEM DESCRIPTION TECHNIQUES 2.1 INTRODUCTION Graphical representation of any process is always better and more meaningful than its representation in words. Moreover, it is very difficult to arrange

### Binary Coded Web Access Pattern Tree in Education Domain

Binary Coded Web Access Pattern Tree in Education Domain C. Gomathi P.G. Department of Computer Science Kongu Arts and Science College Erode-638-107, Tamil Nadu, India E-mail: kc.gomathi@gmail.com M. Moorthi

### CMPS 102 Solutions to Homework 1

CMPS 0 Solutions to Homework Lindsay Brown, lbrown@soe.ucsc.edu September 9, 005 Problem..- p. 3 For inputs of size n insertion sort runs in 8n steps, while merge sort runs in 64n lg n steps. For which

### TREE BASIC TERMINOLOGIES

TREE Trees are very flexible, versatile and powerful non-liner data structure that can be used to represent data items possessing hierarchical relationship between the grand father and his children and

### 1 Solving LPs: The Simplex Algorithm of George Dantzig

Solving LPs: The Simplex Algorithm of George Dantzig. Simplex Pivoting: Dictionary Format We illustrate a general solution procedure, called the simplex algorithm, by implementing it on a very simple example.

### root node level: internal node edge leaf node CS@VT Data Structures & Algorithms 2000-2009 McQuain

inary Trees 1 A binary tree is either empty, or it consists of a node called the root together with two binary trees called the left subtree and the right subtree of the root, which are disjoint from each

### General Flow-Sensitive Pointer Analysis and Call Graph Construction

General Flow-Sensitive Pointer Analysis and Call Graph Construction Endre Horváth, István Forgács, Ákos Kiss, Judit Jász and Tibor Gyimóthy University of Szeged 4D Soft Ltd. Aradi Vértanúk tere 1. Soroksári

### Master Thesis Presentation How To. Before the Presentation. University of Rostock

Master Thesis Presentation How To An almost unlimited amount of material is available (books, workshops, presentations, Internet, ) giving information about how to make an outstanding presentation. In

### ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

ALGEBRA Pupils should be taught to: Generate and describe sequences As outcomes, Year 7 pupils should, for example: Use, read and write, spelling correctly: sequence, term, nth term, consecutive, rule,

Lecture 10 Union-Find The union-nd data structure is motivated by Kruskal's minimum spanning tree algorithm (Algorithm 2.6), in which we needed two operations on disjoint sets of vertices: determine whether

### Vimal P.Parmar Research Scholar, Department of Computer Science Saurashtra University, Rajkot Gujarat, INDIA

Comparing Linear Search and Binary Search Algorithms to Search an Element from a Linear List Implemented through Static Array, Dynamic Array and Linked List Vimal P.Parmar Research Scholar, Department

### Fractions and Decimals

Fractions and Decimals Tom Davis tomrdavis@earthlink.net http://www.geometer.org/mathcircles December 1, 2005 1 Introduction If you divide 1 by 81, you will find that 1/81 =.012345679012345679... The first

### Euclidean 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

### Testing LTL Formula Translation into Büchi Automata

Testing LTL Formula Translation into Büchi Automata Heikki Tauriainen and Keijo Heljanko Helsinki University of Technology, Laboratory for Theoretical Computer Science, P. O. Box 5400, FIN-02015 HUT, Finland

### Chapter 7: Queues and Deques

Chapter 7: Queues and Deques After the stack, the next simplest data abstraction is the queue. As with the stack, the queue can be visualized with many examples you are already familiar with from everyday

### Complexity of Union-Split-Find Problems. Katherine Jane Lai

Complexity of Union-Split-Find Problems by Katherine Jane Lai S.B., Electrical Engineering and Computer Science, MIT, 2007 S.B., Mathematics, MIT, 2007 Submitted to the Department of Electrical Engineering

### Network (Tree) Topology Inference Based on Prüfer Sequence

Network (Tree) Topology Inference Based on Prüfer Sequence C. Vanniarajan and Kamala Krithivasan Department of Computer Science and Engineering Indian Institute of Technology Madras Chennai 600036 vanniarajanc@hcl.in,

### Binary Trees and Huffman Encoding Binary Search Trees

Binary Trees and Huffman Encoding Binary Search Trees Computer Science E119 Harvard Extension School Fall 2012 David G. Sullivan, Ph.D. Motivation: Maintaining a Sorted Collection of Data A data dictionary

### The first step in solving a problem recursively is to formulate a recursive definition of the problem.

Chapter 8 Recursion The subject of this chapter is recursion, an implicit application of the stack ADT. A recursive method is a method that carries out its task by making a call(s) to itself. Each recursive

### Regular Expressions and Automata using Haskell

Regular Expressions and Automata using Haskell Simon Thompson Computing Laboratory University of Kent at Canterbury January 2000 Contents 1 Introduction 2 2 Regular Expressions 2 3 Matching regular expressions

### Performance Tuning using Upsert and SCD. Written By: Chris Price

Performance Tuning using Upsert and SCD Written By: Chris Price cprice@pragmaticworks.com Contents Upserts 3 Upserts with SSIS 3 Upsert with MERGE 6 Upsert with Task Factory Upsert Destination 7 Upsert

### Distributed Dynamic Load Balancing for Iterative-Stencil Applications

Distributed Dynamic Load Balancing for Iterative-Stencil Applications G. Dethier 1, P. Marchot 2 and P.A. de Marneffe 1 1 EECS Department, University of Liege, Belgium 2 Chemical Engineering Department,

### Small Maximal Independent Sets and Faster Exact Graph Coloring

Small Maximal Independent Sets and Faster Exact Graph Coloring David Eppstein Univ. of California, Irvine Dept. of Information and Computer Science The Exact Graph Coloring Problem: Given an undirected

### Homework Exam 1, Geometric Algorithms, 2016

Homework Exam 1, Geometric Algorithms, 2016 1. (3 points) Let P be a convex polyhedron in 3-dimensional space. The boundary of P is represented as a DCEL, storing the incidence relationships between the

### ECON 459 Game Theory. Lecture Notes Auctions. Luca Anderlini Spring 2015

ECON 459 Game Theory Lecture Notes Auctions Luca Anderlini Spring 2015 These notes have been used before. If you can still spot any errors or have any suggestions for improvement, please let me know. 1

### Data 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

### 7 Communication Classes

this version: 26 February 2009 7 Communication Classes Perhaps surprisingly, we can learn much about the long-run behavior of a Markov chain merely from the zero pattern of its transition matrix. In the

### Analysis of Micromouse Maze Solving Algorithms

1 Analysis of Micromouse Maze Solving Algorithms David M. Willardson ECE 557: Learning from Data, Spring 2001 Abstract This project involves a simulation of a mouse that is to find its way through a maze.

### 8.1 Min Degree Spanning Tree

CS880: Approximations Algorithms Scribe: Siddharth Barman Lecturer: Shuchi Chawla Topic: Min Degree Spanning Tree Date: 02/15/07 In this lecture we give a local search based algorithm for the Min Degree

### (Refer Slide Time: 2:03)

Control Engineering Prof. Madan Gopal Department of Electrical Engineering Indian Institute of Technology, Delhi Lecture - 11 Models of Industrial Control Devices and Systems (Contd.) Last time we were

### A 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)

### DATABASE 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

### [Refer Slide Time: 05:10]

Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture

### A New Marketing Channel Management Strategy Based on Frequent Subtree Mining

A New Marketing Channel Management Strategy Based on Frequent Subtree Mining Daoping Wang Peng Gao School of Economics and Management University of Science and Technology Beijing ABSTRACT For most manufacturers,

### A binary search tree is a binary tree with a special property called the BST-property, which is given as follows:

Chapter 12: Binary Search Trees A binary search tree is a binary tree with a special property called the BST-property, which is given as follows: For all nodes x and y, if y belongs to the left subtree

### Optimal Binary Search Trees Meet Object Oriented Programming

Optimal Binary Search Trees Meet Object Oriented Programming Stuart Hansen and Lester I. McCann Computer Science Department University of Wisconsin Parkside Kenosha, WI 53141 {hansen,mccann}@cs.uwp.edu

### Operations: search;; min;; max;; predecessor;; successor. Time O(h) with h height of the tree (more on later).

Binary search tree Operations: search;; min;; max;; predecessor;; successor. Time O(h) with h height of the tree (more on later). Data strutcure fields usually include for a given node x, the following

### 9 Control Statements. 9.1 Introduction. 9.2 Objectives. 9.3 Statements

9 Control Statements 9.1 Introduction The normal flow of execution in a high level language is sequential, i.e., each statement is executed in the order of its appearance in the program. However, depending

### Subgraph Patterns: Network Motifs and Graphlets. Pedro Ribeiro

Subgraph Patterns: Network Motifs and Graphlets Pedro Ribeiro Analyzing Complex Networks We have been talking about extracting information from networks Some possible tasks: General Patterns Ex: scale-free,

### Review; questions Discussion of Semester Project Arbitrary interprocedural control flow Assign (see Schedule for links)

Class 9 Review; questions Discussion of Semester Project Arbitrary interprocedural control flow Assign (see Schedule for links) Readings on pointer analysis Problem Set 5: due 9/22/09 Project proposal