Perform DFS from A A B C D E F G. Perform BFS from A A B C D E F G.

Slides:



Advertisements
Similar presentations
Database Languages Chapter 7. The Relational Algebra.
Advertisements

1 Welcome: To the fifth learning sequence “ Possible representation (2) “ Recap : In the previous learning sequence, we discussed four possible representations.
Unit 5 The Network Model  5.1 The Network Model  5.2 IDMS.
Chapter 3 An Introduction to Relational Databases.
Wei-Pang Yang, Information Management, NDHU More on Normalization Unit 18 More on Normalization ( 表格正規化探討 ) 18-1.
3 bulbs and 4 batteries cost 69p 1 bulb and 2 batteries cost 31p = 69p = 31p What do the following cost? a) 6 bulbs and 8 batteries? b) 4 bulbs and 6 batteries?
CS 1114: Data Structures – memory allocation Prof. Graeme Bailey (notes modified from Noah Snavely, Spring 2009)
N-dimensional space navigation is only possible in a logical rather han a physical world. They didn’t have any books to look after - their information.
1 10/9/06CS150 Introduction to Computer Science 1 for Loops.
CS 206 Introduction to Computer Science II 11 / 12 / 2008 Instructor: Michael Eckmann.
Unit 2 DB2 and SQL Wei-Pang Yang, Information Management, NDHU Outline of Unit Overview DB2 2.2 Data Definition 2.3 Data Manipulation 2.4.
Introduction Chapter 1. Reference Book  Database Systems Thomas Connolly, Carolyn Begg, Anne Strachan Addison-Wesley 1999 ISBN:
Database Systems Lecture # 8 11 th Feb,2011. The Relational Model of Data The term relation is basically just a mathematical term for a table. DBMS products.
1 SELECT statement. 2 Sample database Supplier Part supplies (0,n) colour s# snamep# pname amount citydob price qualitydate.
CS370 Spring 2007 CS 370 Database Systems Lecture 7 The Relational model.
Data Manipulation 11 After this lecture, you should be able to:  Understand the differences between SQL (Structured Query Language) and other programming.
Relational Algebra II. Semantics - where A WHERE X  Y –  : an operator like =, >, … Result of restriction A by the condition X  Y is A relation –with.
6.8 Case Study: E-R for Supplier-and-Parts Database
1 Session 3 Welcome: To session 3-the 8 th. learning sequence “Relational algebra “ Recap : In the previous learning sequence, we discussed some example.
1 Exercises of SQL uAnswer the following questions, based on the database below. wSupplier (SNO, SNAME, STATUS, CITY) wPart(PNO, PNAME, COLOR, WEIGHT)
3-1 Unit 3 The Relational Model. 3-2 Wei-Pang Yang, Information Management, NDHU Outline  3.1 Introduction  3.2 Relational Data Structure  3.3 Relational.
3-1 Unit 3 The Relational Model. 3-2 Wei-Pang Yang, Information Management, NDHU Outline  3.1 Introduction  3.2 Relational Data Structure  3.3 Relational.
Introduction to Data, Information and Knowledge Management Dr. Bhavani Thuraisingham The University of Texas at Dallas Data, Information and Knowledge.
4B-1 Wei-Pang Yang, Information Management, NDHU Introduction to Database CHAPTER 4B ( 補 ) DB2 and SQL  Overview  Data Definition  Data Manipulation.
1 Structured Query Language (SQL) CIS*2450 Advanced Programming Concepts.
Logical Database Design ( 補 ) Unit 7 Logical Database Design ( 補 )
Wei-Pang Yang, Information Management, NDHU Normalization Unit 7 Normalization ( 表格正規化 ) 7-1.
Chapter 10 Views. Topics in this Chapter What are Views For? View Retrievals View Updates Snapshots SQL Facilities.
Chapter 7 Relational Algebra. Topics in this Chapter Closure Revisited The Original Algebra: Syntax and Semantics What is the Algebra For? Further Points.
Further Normalization I
Data Definition After this lecture, you should be able to:
Data Manipulation 21 After this lecture, you should be able to:  Use SQL SELECT statement effectively to retrieve the data from multiple related tables.
Unit 5 The Network Model  5.1 Data Modeling Issues  5.2 The Network Model  5.3 IDMS.
Algebra1 After this lecture, you should be able to:  Understand the differences between SQL (Structured Query Language) and Relational Algebra expressions.
Computer Science and Software Engineering University of Wisconsin - Platteville 8. Comparison of Algorithms Yan Shi CS/SE 2630 Lecture Notes Part of this.
Chapter 4 An Introduction to SQL. Copyright © 2004 Pearson Addison-Wesley. All rights reserved.4-2 Topics in this Chapter SQL: History and Overview The.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
An Introduction to SQL For CS Overview of SQL  It is the standard language for relational systems, although imperfect  Supports data definition.
Index in Database Unit 12 Index in Database 大量資料存取方法之研究 Approaches to Access/Store Large Data 楊維邦 博士 國立東華大學 資訊管理系教授.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
Unit 2 DB2 and SQL. 2-2 Wei-Pang Yang, Information Management, NDHU Outline of Unit Overview 2.2 Data Definition 2.3 Data Manipulation 2.4 The System.
DS.A.1 Algorithm Analysis Chapter 2 Overview Definitions of Big-Oh and Other Notations Common Functions and Growth Rates Simple Model of Computation Worst.
Hashing Goal Perform inserts, deletes, and finds in constant average time Topics Hash table, hash function, collisions Collision handling Separate chaining.
Paris Lisbon Madrid Reykjavik Dublin London Oslo Stockholm Helsinki Berlin Warsaw Athens Vatican City (Rome) Kiev.
Views Prof. Yin-Fu Huang CSIE, NYUST Chapter 10. Advanced Database System Yin-Fu Huang 10.1Introduction Example: Var Good_Supplier View (S Where Status.
Algorithm Complexity & Big-O Notation: From the Basics CompSci Club 29 May 2014.
Relations with Stored and Inherited Attributes Witold Litwin Dauphine University June 13, 2016.
Structured Query Language IV Asma Ahmad (C. J. Date) Database Systems.
STRUCTURE OF PRESENTATION :
“ Possible representation (3) “
Lecture 3 : Structured Query Language (SQL)
Unit 2 DB2 and SQL.
for Computer Professionals
Introduction to Data, Information and Knowledge Management
Review for Midterm Neil Tang 03/04/2010
Big-Oh and Execution Time: A Review
Hash In-Class Quiz.
Introduction to Database
Introduction to Database
پايگاه داده ها.
Φροντιστήριο SQL (από το βιβλίο του Date)
DS.A.1 Algorithm Analysis Chapter 2 Overview
Analyzing and Securing Social Networks
Unit 7 Normalization (表格正規化).
“ Possible representation (2) “
8. Comparison of Algorithms
STRUCTURE OF PRESENTATION :
Question 1: Basic Concepts (45 %)
STRUCTURE OF PRESENTATION :
Unit 12 Index in Database 大量資料存取方法之研究 Approaches to Access/Store Large Data 楊維邦 博士 國立東華大學 資訊管理系教授.
Presentation transcript:

Perform DFS from A A B C D E F G

Perform BFS from A A B C D E F G

Several Topological Orderings CSI CSII CSIII CS2813 CS4833 CSI, CS 2813, CSII, CS 4833, CSIIIor CS I, CS 2813, CSII, CSIII, CS 4833or CSI, CSII, CS 2813, CS 4833, CSIIIetc

Linear Probing Hash(89,10) = 9 (hash function is key (89) % 10) Hash(18,10) = 8 Hash(49,10) = 9 Hash(58,10) = 8 Hash( 9,10) = 9 After Insert After Insert After Insert After Insert After Insert

Quadratic Probing Hash(89,10) = 9 Hash(18,10) = 8 Hash(49,10) = 9 Hash(58,10) = 8 Hash( 9,10) = 9 After Insert After Insert After Insert After Insert After Insert

Relational Algebra An Example Consider the example of parts that are shipped by various suppliers from warehouses in various cities where they are stored to jobs in different cities: SUPPLIER s# name status city S1 Smith 20 London S2 Jones 10 Paris S3 Blake 30 Paris S4 Clark 20 London S5 Adams 30 Athens PART p# name color weight city * P1 nut red 12 London P2 bolt green 17 Paris P3 screw blue 17 Rome P4 screw red 14 London P5 cam blue 12 Paris P6 cog red 19 London JOB j# name city J1 sorter Paris J2 punch Rome J3 reader Athens J4 console Athens J5 collator London J6 terminal Oslo * City where part is stored (example from: C.J. Date, An Introduction to Database Systems, Addison-Wesley, 1990)

Relational Algebra An Example  Find information about all red parts:  color = red ( PART ) u Find information about all red parts weighing more than 15 lbs:   (color = red) AND (weight > 15) ( PART )  Find names of all red parts:  name (  color = red ( PART ) )  Find names of suppliers with who are located in cities where screws are stored:  S.name (  P.name=screw ( SUPPLIER S.city = P.city PART ) )

Relational Algebra An Example SHIPMENT s# p# j# qty S1 P1 J1 200 S1 P1 J4 700 S2 P3 J1 400 S2 P3 J2 200 S2 P3 J3 200 S2 P3 J4 500 S2 P3 J5 600 S2 P3 J6 400 S2 P5 J2 100 S3 P3 J1 200 S3 P4 J2 500 S4 P6 J3 300 S5 P2 J2 200 S5 P2 J4 100 S5 P5 J5 500 S5 P6 J2 200 S5 P1 J4 100 S5 P3 J4 200 S5 P4 J4 800 S5 P5 J4 400 S5 P6 J4 500 Find names of suppliers who shipped more that 500 red parts Get part numbers for parts supplied by a supplier in London. Find Smith’s jobs that use red parts Find names of parts shipped by Jones for jobs in London Find names of red parts sent by London suppliers to Paris jobs

Analysis of Nested Loops EXAMPLE 1: for (int i = 0; i < n; i++)// n*O(n) = O(n 2 ) for (int j=0; j<n;j++)// n*O(1) = O(n) x++;// O(1) EXAMPLE 2: for (int i = 0; i < n; i++) for (int j=i; j<n;j++) x++;// O(1) T(n) = n+(n-1) + (n-2)+…+ 1 = n(n+1)/2 = O(n 2 )

Summing blocks of statements for (int i = 0; i < n; i++)// O(n 2 ) for (int j=0; j<n;j++) x++; for (int i = 0; i < n; i++)// O(n) x++; T(n) = O(n 2 ) + O(n) = O(n 2 + n) = O(n 2 )

Loops with different limits for (int i = 0; i < n; i++)// n*O(m) = O(mn) for (int j=0; j<m; j++)// m*O(1) = O(m) x++;// O(1) O(mn)

More complex loops for (i = 1;i < n; i *=2) x++; for (i=n; i > 0; i/=2) x++; Repetitive halving or doubling results in logarithmic complexity. Both loops are O( log n)

Allocating Free Blocks: Strategies first fit - Traverse the list to find available block large enough; allocate from first such block found best fit - Traverse the list to find the smallest available block that is large enough; allocate from it worst fit - Traverse list to find largest available block and allocate from it (if large enough)