Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit


 Wesley Jordan
 6 years ago
 Views:
Transcription
1 Data Structures Page 1 of 24
2 A.1. Arrays (Vectors) nelement vector start address + ielementsize n1 start address continuous memory block static, if size is known at compile time dynamic, if size is determined at run time random access of O(1) to each element optimal cache prefetch, pipelining for sequential processing of data Page 2 of 24
3 n Index calculation 2dimensional array (matrix) startaddress n n21 (0,0) (0,1) +n 2 +n n21 (1,0) (1,1)... +(n11)n2 +nn n 1 startaddress + (i n +i ) elementsize based indices (0 i d n d 1 d dim): ( address = startaddress + elementsize (for 1based indices replace i d with (i d 1)) startaddress i dim + dim 1 d=1 n 3 ( )) dim i d p=d+1 n p Page 3 of 24 n 1 +(n11)n2n 3 +(n n 21)n +n1n2n 31
4 insertion/deletion of vector elements needs copy operations insert an element into a vector vector more data copy data new allocated vector if enough extra memory is reserved (at the end), there s no need to allocate a new vector delete an element into a vector copy elements memory leak Page 4 of 24 allocation of new vector to avoid memory leaks arrays are unflexible with respect of insertion/deletion
5 A.2. Lists (double) linked list intrusive nonintrusive data data there s a pointer to the next element double linked lists have also pointer to previous element intrusive lists store data elements in links (elements belong to no more than one list) for cyclic lists the first and last element are connected (there s no first or last element...) (bi)directional sequential access (iterator) O(n) access to elements Page 5 of 24
6 insertion/deletion of list elements needs changing pointers insert an element into a list delete an element from a list Page 6 of 24 lists are flexible to insert/remove sublists
7 A.3. Hash tables hash table a hash function will map a search key to a table entry the hash function is not surjective: a table entry might be empty not injective: > 1 search keys might be mapped to a table entry collision handling necessary common method: a collision list for each table entry instead of one large list, there will be several smaller ones combining array and list... Page 7 of 24
8 A.4. Trees binary tree root layer 0 layer 1 leave a tree is a graph, which consists of nodes and edges one node is called root node each node, except the root node, has one parent and is a child of that node a leaf node has no children there s exactly one path from one node to another nodes with the same depth l (distance to the root) form the layer l a tree with l layers has height h = l, which is the maximum depth the structure is recursive: a node with all its children and their children forms a subtree the nodes of a binary tree have at most 2 children: a left and a right one the lth layer of a binary tree can at most contains 2 l, the full (complete) tree n = 2 h+1 1 nodes. The height of such a tree is h = log 2 (n + 1) 1 Page 8 of 24
9 Syntax/Expression trees * inorder traversal: ( (74) * 5) preorder traversal: (* ( 7 4) 5) postorder traversal: ( (7 4 ) 5 *) the inner nodes of this binary tree contain binary (or unary) operators with the children as operands each leaf node contains a constant (or variable) postorder traversal (left child,right child,root node) leads to postfix notation, known as RPN (Reverse Polish Notation) (stack) widespread infix notation needs brackets (postfix doesn t) Page 9 of 24
10 PointkDtree w w each node represents a point P R d 000 each node recursivly subdivides the (sub)domain (implicitly) in 2 subdomains by a hyperplane containing that point, and which is parallel to an alternating coordinate axis Page 10 of 24
11 PointQuadtree w w each node represents a point P R 2 (R d ) 010 each node recursivly subdivides the (sub)domain (implicitly) in 4 (2 d ) subdomains by 2 straight lines (d hyperplanes) containing that point and which are parallel to the coordinate axis Page 11 of 24
12 RegionQuadtree each node represents a two dimensional region, the root represents the whole domain the nodes of each layer correspond to equal sized regions the side lengths are halved for the next layer leaf nodes are marked inside/outside Page 12 of 24
13 A.5. Abstract Data Structures stack (LIFO) queue (FIFO) Stack: LIFO principle: Last In First Out operations: * push: put a new element on the top of the stack * pop: get an element from the top of the stack Queue: FIFO principle: First In First Out operations: * push: put a new element to the end of the queue * pull: get the element at the beginning of the queue Stacks and queues can be implemented with an list (or an vector). Page 13 of 24
14 Priority Queue: there s a priority value for each element the element with the highest priority is always pulled setting increasing/decreasing priority values will emulate a stack/queue implementation with a (sorted) list, a sorted/partially ordered binary tree or heap (partially ordered tree mapped onto an array) Partially Ordered binary Tree (POT): elements of a lower layer are greater: childs > parent (analogous: smaller childs < parent) add element initial config. 1 insert element bubbleup 1 bubbleup 2 final config. 1 remove element initial config. 2 delete&replace element bubbledown (smaller child) final config. 2 heap of initial config. 1 POT: layerwise with 1based index: idx child1 = idx parent 2, idx child2 = idx child1 + 1, idx parent = idx child 2 Page 14 of 24
15 Graphs A graph is a pair G = (V, E) with nodes/vertices V (G) = {v i i = 1,..., n} and edges E(G) = {e ij =< v i, v j > v i, v j V (G)} (a graph contains topological, but no geometrical information) for a directed graph/digraph these edges are ordered pairs of vertices (arrows), whereas for an undirected graph they re unordered (lines). A symmetric digraph (also including inverted edges) is equivalent to an undirected graph The degree of a vertex is the number of edges incident to the vertex A weight w ij := w (e ij ) R is assigned to each edge e ij E(G), if G is a weighted graph. (vertices weights are also possible) V 1 V 4 V 7 V V V 5 20 V V 9 5 V 10 8 Page 15 of 24
16 A.6. Data structures for graphs a graph can be stored as array/matrix: each element stores the weight v 1 v 2 v 3 v 4 v 5 v 6 v 7 v 8 v 9 v v 2 12 v 3 5 v v v v 7 5 v v 9 3 edgelist: each element stores the vertices ids and the weigth e 1 v 1 v 2 40 e 2 v 1 v 4 3 e 3 v 2 v 4 12 e 4 v 3 v 2 5 e 5 v 4 v 7 7 e 6 v 4 v 8 14 e 7 v 5 v 2 6 e 8 v 5 v e 9 v 5 v 6 20 e 10 v 6 v 2 10 e 11 v 6 v 3 12 e 12 v 7 v 8 5 e 13 v 8 v 5 25 e 14 v 8 v 6 13 e 15 v 8 v 9 10 e 16 v 9 v 6 3 Page 16 of 24
17 adjacency lists: each vertex object stores the adjacent vertices v 1 v 2 40 v 4 3 v 2 v 4 12 v 3 v 2 5 v 4 v 7 7 v 8 14 v 5 v 2 6 v v 6 20 v 6 v 2 10 v 3 12 v 7 v 8 5 v 8 v 5 25 v 6 13 v 9 10 v 9 v 6 3 or edges v 1 e 1 e 2 v 2 e 3 v 3 e 4 v 4 e 5 e 6 v 5 e 7 e 8 e 9 v 6 e 10 e 11 v 7 e 12 v 8 e 13 e 14 e 15 v 9 e 16 (cmp. hash table) Page 17 of 24
18 Traversal of a graph from a starting vertex breadthfirst traversal Algorithm: 1. add starting vertex to a queue 2. as long as queue is not empty (a) pull vertex out of queue and mark it (b) add adjacent unmarked vertices to queue depthfirst traversal analogous to breadthfirst traversal, but use stack instead of queue leads to graph search algorithms breadthfirst search (BFS) and depthfirst search (DFS) also check pulled vertex and stop, if it fulfills the search condition Page 18 of 24
19 Matrix bandwidth optimization find node numbering in an undirected (unweighted) graph, such as the maximum absolute node number difference between adjacent nodes is minimized bandwidth optimization within FEM codes based on direct solvers problem is NPcomplete heuristic approaches CuthillMcKee algorithm: node with minimal degree is typically chosen as starting node breadthfirst traversal with adjacent vertices added in increasing order of degree and pulled vertices numbered in increasing order Reverse CuthillMcKee algorithm: resulting index numbers are reversed: i N i + 1 i (which is equivalent to numbering in decreasing order) Page 19 of 24
20 Shortest paths find the shortest path in an directed weighted graph from v start to v target (or to all other vertices) each vertex on the shortest path is visited only once (cmp. Hamiltonian path) to find the shortest path to a vertex, the shortest path of the predecessor of that vertex has to be found. (recursive formulation) each vertex just has to store its predecessor shortest path tree Dijkstra algorithm: like BFS/DFS, but with Priority queue based on min. distances to the vertex and new shortest distances instead of marks. V 1 V 4 V V 2 V V 5 V V 9 V Page 20 of 24
21 Dijkstra algorithm: 1 v start, v target V given start, targetnode 2 w i,j R + edge lengths, 3 v.adj V given successor 4 v.dist R + distances, 5 v.pre V predecessors to be determined 6 v, v K V 7 v.dist, d R + declaration 8 B V 9 foreach v V do initialization 10 v.pre NULL shortest path predecessor unknown 11 end foreach 12 v start.pre v start initialize start node 13 v start.dist 0 14 B {v start} initialize front 15 while B do 16 v K choose v B v.dist = min choose node from front 17 B B \ {v K } and remove it 18 if v K = v target do end reached target? 19 foreach v v K.adj do check successor 20 d v K.dist + w vk,v calculate new distance berechnen 21 if v.pre = NULL do successor new? 22 v.pre v K initialize successor 23 v.dist d 24 B B {v} push to front 25 else do successor already in front 26 if d < v.dist do new path shorter? 27 B B \ {v} 28 v.pre v K reinitialize successor 29 v.dist d 30 B B {v} and change priority in Front 31 end if 32 end if 33 end foreach 34 end while Page 21 of 24
22 Dijkstra algorithm example V 1 V 4 V 7 V V V 5 20 V V 9 5 V Page 22 of 24
23 Page 23 of 24
24 step v K v K.adj B 1 < v 1 > 2 v 1 < v 4, v 2 > < v 4, v 2 > 3 v 4 < v 7, v 8 > < v 7, v 8, v 2 > 4 v 7 < v 8 > < v 8, v 2 > 5 v 8 < v 9, v 6, v 5 > < v 9, v 6, v 2, v 5 > 6 v 9 < v 6 > < v 6, v 2, v 5 > 7 v 6 < v 2, v 3 > < v 2, v 3, v 5 > 8 v 2 < v 4 > < v 3, v 5 > step dist step pre v 1 v 1 NULL NULL NULL NULL NULL NULL NULL 2 v 1 v 1 NULL v 1 NULL NULL NULL NULL NULL 3 v 1 v 1 NULL v 1 NULL NULL v 4 v 4 NULL 4 v 1 v 1 NULL v 1 NULL NULL v 4 v 7 NULL 5 v 1 v 1 NULL v 1 v 8 v 8 v 4 v 7 v 8 6 v 1 v 1 NULL v 1 v 8 v 8 v 4 v 7 v 8 7 v 1 v 6 v 6 v 1 v 8 v 8 v 4 v 7 v 8 8 v 1 v 6 v 6 v 1 v 8 v 8 v 4 v 7 v 8 Page 24 of 24
DATA 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 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 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 informationKrishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA213 : 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 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 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 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 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 informationAlgorithms and Data Structures
Algorithms and Data Structures Part 2: Data Structures PD Dr. rer. nat. habil. RalfPeter Mundani Computation in Engineering (CiE) Summer Term 2016 Overview general linked lists stacks queues trees 2 2
More informationCSE 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 informationData 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
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 informationBinary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( BST) are of the form. P parent. Key. Satellite data L R
Binary Search Trees A Generic Tree Nodes in a binary search tree ( BST) are of the form P parent Key A Satellite data L R B C D E F G H I J The BST has a root node which is the only node whose parent
More informationINTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY
INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY A PATH FOR HORIZING YOUR INNOVATIVE WORK A REVIEW ON THE USAGE OF OLD AND NEW DATA STRUCTURE ARRAYS, LINKED LIST, STACK,
More informationMAX = 5 Current = 0 'This will declare an array with 5 elements. Inserting a Value onto the Stack (Push) 
=============================================================================================================================== DATA STRUCTURE PSEUDOCODE EXAMPLES (c) Mubashir N. Mir  www.mubashirnabi.com
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 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 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 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 60:
More informationData Structures and Data Manipulation
Data Structures and Data Manipulation What the Specification Says: Explain how static data structures may be used to implement dynamic data structures; Describe algorithms for the insertion, retrieval
More informationAtmiya Infotech Pvt. Ltd. Data Structure. By Ajay Raiyani. Yogidham, Kalawad Road, Rajkot. Ph : 572365, 576681 1
Data Structure By Ajay Raiyani Yogidham, Kalawad Road, Rajkot. Ph : 572365, 576681 1 Linked List 4 Singly Linked List...4 Doubly Linked List...7 Explain Doubly Linked list: ...7 Circular Singly Linked
More informationA binary search tree is a binary tree with a special property called the BSTproperty, which is given as follows:
Chapter 12: Binary Search Trees A binary search tree is a binary tree with a special property called the BSTproperty, which is given as follows: For all nodes x and y, if y belongs to the left subtree
More informationPES Institute of TechnologyBSC QUESTION BANK
PES Institute of TechnologyBSC 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 informationroot node level: internal node edge leaf node CS@VT Data Structures & Algorithms 20002009 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
More informationStatic Load Balancing
Load Balancing Load Balancing Load balancing: distributing data and/or computations across multiple processes to maximize efficiency for a parallel program. Static loadbalancing: the algorithm decides
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 informationBinary Search Trees (BST)
Binary Search Trees (BST) 1. Hierarchical data structure with a single reference to node 2. Each node has at most two child nodes (a left and a right child) 3. Nodes are organized by the Binary Search
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 Breadthfirst search (BFS) 4 Applications
More informationParallelization: Binary Tree Traversal
By Aaron Weeden and Patrick Royal Shodor Education Foundation, Inc. August 2012 Introduction: According to Moore s law, the number of transistors on a computer chip doubles roughly every two years. First
More informationBinary 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
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 informationThe 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
More information10CS35: 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
More informationData Structures and Algorithms
Data Structures and Algorithms CS2452016S06 Binary Search Trees David Galles Department of Computer Science University of San Francisco 060: Ordered List ADT Operations: Insert an element in the list
More informationTREE BASIC TERMINOLOGIES
TREE Trees are very flexible, versatile and powerful nonliner data structure that can be used to represent data items possessing hierarchical relationship between the grand father and his children and
More informationLearning Outcomes. COMP202 Complexity of Algorithms. Binary Search Trees and Other Search Trees
Learning Outcomes COMP202 Complexity of Algorithms Binary Search Trees and Other Search Trees [See relevant sections in chapters 2 and 3 in Goodrich and Tamassia.] At the conclusion of this set of lecture
More informationData Structures Using C++
Data Structures Using C++ 1.1 Introduction Data structure is an implementation of an abstract data type having its own set of data elements along with functions to perform operations on that data. Arrays
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 informationECE 250 Data Structures and Algorithms MIDTERM EXAMINATION 20081023/5:156:45 REC200, EVI350, RCH106, HH139
ECE 250 Data Structures and Algorithms MIDTERM EXAMINATION 20081023/5:156:45 REC200, EVI350, RCH106, HH139 Instructions: No aides. Turn off all electronic media and store them under your desk. If
More informationCompSci61B, Data Structures Final Exam
Your Name: CompSci61B, Data Structures Final Exam Your 8digit 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 informationData Structures. Level 6 C30151. www.fetac.ie. Module Descriptor
The Further Education and Training Awards Council (FETAC) was set up as a statutory body on 11 June 2001 by the Minister for Education and Science. Under the Qualifications (Education & Training) Act,
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 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 informationData Structure and Algorithm I Midterm Examination 120 points Time: 9:10am12:10pm (180 minutes), Friday, November 12, 2010
Data Structure and Algorithm I Midterm Examination 120 points Time: 9:10am12:10pm (180 minutes), Friday, November 12, 2010 Problem 1. In each of the following question, please specify if the statement
More informationPrevious Lectures. BTrees. External storage. Two types of memory. Btrees. Main principles
BTrees Algorithms and data structures for external memory as opposed to the main memory BTrees Previous Lectures Height balanced binary search trees: AVL trees, redblack trees. Multiway search trees:
More informationDynamic programming. Doctoral course Optimization on graphs  Lecture 4.1. Giovanni Righini. January 17 th, 2013
Dynamic programming Doctoral course Optimization on graphs  Lecture.1 Giovanni Righini January 1 th, 201 Implicit enumeration Combinatorial optimization problems are in general NPhard and we usually
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): 22790063 ISSN (Online): 22790071 International
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 informationGUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. Course Curriculum. DATA STRUCTURES (Code: 3330704)
GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT Course Curriculum DATA STRUCTURES (Code: 3330704) Diploma Programme in which this course is offered Semester in which offered Computer Engineering,
More informationData Structures and Algorithms(5)
Ming Zhang Data Structures and Algorithms Data Structures and Algorithms(5) Instructor: Ming Zhang Textbook Authors: Ming Zhang, Tengjiao Wang and Haiyan Zhao Higher Education Press, 2008.6 (the "Eleventh
More informationData Structures and Algorithms V22.0102. Otávio Braga
Data Structures and Algorithms V22.0102 Otávio Braga We use a stack When an operand is read, output it When an operator is read Pop until the top of the stack has an element of lower precedence Then push
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 informationBig Data and Scripting. Part 4: Memory Hierarchies
1, Big Data and Scripting Part 4: Memory Hierarchies 2, Model and Definitions memory size: M machine words total storage (on disk) of N elements (N is very large) disk size unlimited (for our considerations)
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 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 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 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 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 informationLoad Balancing and Termination Detection
Chapter 7 Load Balancing and Termination Detection 1 Load balancing used to distribute computations fairly across processors in order to obtain the highest possible execution speed. Termination detection
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 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 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 informationExercises Software Development I. 11 Recursion, Binary (Search) Trees. Towers of Hanoi // Tree Traversal. January 16, 2013
Exercises Software Development I 11 Recursion, Binary (Search) Trees Towers of Hanoi // Tree Traversal January 16, 2013 Software Development I Winter term 2012/2013 Institute for Pervasive Computing Johannes
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 informationBinary Heaps. CSE 373 Data Structures
Binary Heaps CSE Data Structures Readings Chapter Section. Binary Heaps BST implementation of a Priority Queue Worst case (degenerate tree) FindMin, DeleteMin and Insert (k) are all O(n) Best case (completely
More informationNetwork (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,
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 informationIntroduction to Data Structures
Introduction to Data Structures Albert Gural October 28, 2011 1 Introduction When trying to convert from an algorithm to the actual code, one important aspect to consider is how to store and manipulate
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 informationCHAPTER 4 ESSENTIAL DATA STRUCTRURES
CHAPTER 4 ESSENTIAL DATA STRUCTURES 72 CHAPTER 4 ESSENTIAL DATA STRUCTRURES In every algorithm, there is a need to store data. Ranging from storing a single value in a single variable, to more complex
More informationLoad Balancing. Load Balancing 1 / 24
Load Balancing Backtracking, branch & bound and alphabeta pruning: how to assign work to idle processes without much communication? Additionally for alphabeta pruning: implementing the youngbrotherswait
More informationLoad balancing. David Bindel. 12 Nov 2015
Load balancing David Bindel 12 Nov 2015 Inefficiencies in parallel code Poor single processor performance Typically in the memory system Saw this in matrix multiply assignment Overhead for parallelism
More informationCpt S 223. School of EECS, WSU
The Shortest Path Problem 1 ShortestPath 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 informationA number of tasks executing serially or in parallel. Distribute tasks on processors so that minimal execution time is achieved. Optimal distribution
Scheduling MIMD parallel program A number of tasks executing serially or in parallel Lecture : Load Balancing The scheduling problem NPcomplete problem (in general) Distribute tasks on processors so that
More informationQuiz 4 Solutions EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II. 1 Q u i z 4 S o l u t i o n s
Quiz 4 Solutions Q1: What value does function mystery return when called with a value of 4? int mystery ( int number ) { if ( number
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 informationLinked Lists, Stacks, Queues, Deques. It s time for a chainge!
Linked Lists, Stacks, Queues, Deques It s time for a chainge! Learning Goals After this unit, you should be able to... Differentiate an abstraction from an implementation. Define and give examples of problems
More informationWhy Use Binary Trees?
Binary Search Trees Why Use Binary Trees? Searches are an important application. What other searches have we considered? brute force search (with array or linked list) O(N) binarysearch with a presorted
More informationCpt S 223. School of EECS, WSU
Priority Queues (Heaps) 1 Motivation Queues are a standard mechanism for ordering tasks on a firstcome, firstserved basis However, some tasks may be more important or timely than others (higher priority)
More informationOutline. NPcompleteness. When is a problem easy? When is a problem hard? Today. Euler Circuits
Outline NPcompleteness Examples of Easy vs. Hard problems Euler circuit vs. Hamiltonian circuit Shortest Path vs. Longest Path 2pairs sum vs. general Subset Sum Reducing one problem to another Clique
More information7.1 Our Current Model
Chapter 7 The Stack In this chapter we examine what is arguably the most important abstract data type in computer science, the stack. We will see that the stack ADT and its implementation are very simple.
More informationBTrees. Algorithms and data structures for external memory as opposed to the main memory BTrees. B trees
BTrees Algorithms and data structures for external memory as opposed to the main memory BTrees Previous Lectures Height balanced binary search trees: AVL trees, redblack trees. Multiway search trees:
More informationStructural Design Patterns Used in Data Structures Implementation
Structural Design Patterns Used in Data Structures Implementation Niculescu Virginia Department of Computer Science BabeşBolyai University, ClujNapoca email address: vniculescu@cs.ubbcluj.ro November,
More informationApproximation Algorithms
Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NPCompleteness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms
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 informationAlgorithms and Data S tructures Structures Stack, Queues, and Applications Applications Ulf Leser
Algorithms and Data Structures Stack, Queues, and Applications Ulf Leser Content of this Lecture Stacks and Queues Tree Traversal Towers of Hanoi Ulf Leser: Alg&DS, Summer semester 2011 2 Stacks and Queues
More informationChapter 7 Load Balancing and Termination Detection
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 informationCSE 4351/5351 Notes 7: Task Scheduling & Load Balancing
CSE / Notes : Task Scheduling & Load Balancing Task Scheduling A task is a (sequential) activity that uses a set of inputs to produce a set of outputs. A task (precedence) graph is an acyclic, directed
More informationGlossary of Object Oriented Terms
Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction
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 informationLoad Balancing and Termination Detection
Chapter 7 slides71 Load Balancing and Termination Detection slides72 Load balancing used to distribute computations fairly across processors in order to obtain the highest possible execution speed. Termination
More informationA Fast Algorithm For Finding Hamilton Cycles
A Fast Algorithm For Finding Hamilton Cycles by Andrew Chalaturnyk A thesis presented to the University of Manitoba in partial fulfillment of the requirements for the degree of Masters of Science in Computer
More information6.852: Distributed Algorithms Fall, 2009. Class 2
.8: Distributed Algorithms Fall, 009 Class Today s plan Leader election in a synchronous ring: Lower bound for comparisonbased algorithms. Basic computation in general synchronous networks: Leader election
More informationTopological Properties
Advanced Computer Architecture Topological Properties Routing Distance: Number of links on route Node degree: Number of channels per node Network diameter: Longest minimum routing distance between any
More informationCommon Data Structures
Data Structures 1 Common Data Structures Arrays (single and multiple dimensional) Linked Lists Stacks Queues Trees Graphs You should already be familiar with arrays, so they will not be discussed. Trees
More informationAlgorithms and Data Structures
Algorithms and Data Structures CMPSC 465 LECTURES 2021 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 informationData Structures UNIT III. Model Question Answer
Data Structures UNIT III Model Question Answer Q.1. Define Stack? What are the different primitive operations on Stack? Ans: Stack: A stack is a linear structure in which items may be added or removed
More informationChapter 3: Restricted Structures Page 1
Chapter 3: Restricted Structures Page 1 1 2 3 4 5 6 7 8 9 10 Restricted Structures Chapter 3 Overview Of Restricted Structures The two most commonly used restricted structures are Stack and Queue Both
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 informationCatalan Numbers. Thomas A. Dowling, Department of Mathematics, Ohio State Uni versity.
7 Catalan Numbers Thomas A. Dowling, Department of Mathematics, Ohio State Uni Author: versity. Prerequisites: The prerequisites for this chapter are recursive definitions, basic counting principles,
More information