Overzicht Informatica

Slides:



Advertisements
Similar presentations
Numbers Treasure Hunt Following each question, click on the answer. If correct, the next page will load with a graphic first – these can be used to check.
Advertisements

Simplifications of Context-Free Grammars
Variations of the Turing Machine
3rd Annual Plex/2E Worldwide Users Conference 13A Batch Processing in 2E Jeffrey A. Welsh, STAR BASE Consulting, Inc. September 20, 2007.
Process Description and Control
AP STUDY SESSION 2.
1
Copyright © 2003 Pearson Education, Inc. Slide 1.
Copyright © 2003 Pearson Education, Inc. Slide 1 Computer Systems Organization & Architecture Chapters 8-12 John D. Carpinelli.
Copyright © 2003 Pearson Education, Inc. Slide 7-1 Created by Cheryl M. Hughes The Web Wizards Guide to XML by Cheryl M. Hughes.
1 Copyright © 2013 Elsevier Inc. All rights reserved. Chapter 4 Computing Platforms.
Sequential Logic Design
Processes and Operating Systems
Copyright © 2013 Elsevier Inc. All rights reserved.
David Burdett May 11, 2004 Package Binding for WS CDL.
CALENDAR.
Chapter 6 File Systems 6.1 Files 6.2 Directories
1 Chapter 12 File Management Patricia Roy Manatee Community College, Venice, FL ©2008, Prentice Hall Operating Systems: Internals and Design Principles,
1 Click here to End Presentation Software: Installation and Updates Internet Download CD release NACIS Updates.
Office 2003 Introductory Concepts and Techniques M i c r o s o f t Windows XP Project An Introduction to Microsoft Windows XP and Office 2003.
Photo Slideshow Instructions (delete before presenting or this page will show when slideshow loops) 1.Set PowerPoint to work in Outline. View/Normal click.
1.
Break Time Remaining 10:00.
Turing Machines.
Database Performance Tuning and Query Optimization
PP Test Review Sections 6-1 to 6-6
11 Data Structures Foundations of Computer Science ã Cengage Learning.
1 IMDS Tutorial Integrated Microarray Database System.
Abstract Data Types and Algorithms
Chapter 1 Object Oriented Programming 1. OOP revolves around the concept of an objects. Objects are created using the class definition. Programming techniques.
Data structure is concerned with the various ways that data files can be organized and assembled. The structures of data files will strongly influence.
Briana B. Morrison Adapted from William Collins
Hash Tables.
EIS Bridge Tool and Staging Tables September 1, 2009 Instructor: Way Poteat Slide: 1.
2000 Deitel & Associates, Inc. All rights reserved. Chapter 16 – Bits, Characters, Strings, and Structures Outline 16.1Introduction 16.2Structure Definitions.
Slide 8-1 Copyright © 2003 Pearson Education, Inc. Overzicht Informatica College 9 – November 1 Computer Science an overview EDITION 7 J. Glenn Brookshear.
Operating Systems Operating Systems - Winter 2012 Chapter 4 – Memory Management Vrije Universiteit Amsterdam.
Operating Systems Operating Systems - Winter 2010 Chapter 3 – Input/Output Vrije Universiteit Amsterdam.
Exarte Bezoek aan de Mediacampus Bachelor in de grafische en digitale media April 2014.
Chapter 6 File Systems 6.1 Files 6.2 Directories
Copyright © 2012, Elsevier Inc. All rights Reserved. 1 Chapter 7 Modeling Structure with Blocks.
Adding Up In Chunks.
MaK_Full ahead loaded 1 Alarm Page Directory (F11)
1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
1 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt 10 pt 15 pt 20 pt 25 pt 5 pt Synthetic.
Artificial Intelligence
: 3 00.
5 minutes.
1 hi at no doifpi me be go we of at be do go hi if me no of pi we Inorder Traversal Inorder traversal. n Visit the left subtree. n Visit the node. n Visit.
Chapter 12: Designing Databases
Essential Cell Biology
Converting a Fraction to %
Clock will move after 1 minute
Chapter 11 Creating Framed Layouts Principles of Web Design, 4 th Edition.
Essential Cell Biology
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13 Pointers and Linked Lists.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 13 - Exception Handling Outline 13.1 Introduction 13.2 Exception-Handling Overview 13.3 Other.
Physics for Scientists & Engineers, 3rd Edition
Energy Generation in Mitochondria and Chlorplasts
Select a time to count down from the clock above
Copyright Tim Morris/St Stephen's School
1.step PMIT start + initial project data input Concept Concept.
9. Two Functions of Two Random Variables
FIGURE 3-1 Basic parts of a computer. Dale R. Patrick Electricity and Electronics: A Survey, 5e Copyright ©2002 by Pearson Education, Inc. Upper Saddle.
Presentation transcript:

Overzicht Informatica College 10 – Oktober 31 Computer Science an overview EDITION 7 / 8 J. Glenn Brookshear

C H A P T E R 8 (was Chap. 7) Data Structures Abstractions of the actual data organization in main memory Allow users to perceive data as ‘logical units’ (e.g.: arrangement in rows and columns)

Data Structure Basics: Pointers pointer = location in memory that contains the address of another location in memory so: pointer points to data positioned elsewhere in memory F02A FF8C 64B0

Static versus Dynamic Data Structures shape & size of structure does not change over time example in C: int Table[2][9]; Table: Dynamic: shape & size may change example: Stack 48 97 17 Stack: 32 65

Arrays Example: to store 24 hourly temperature readings… … a convenient storage structure is 1-D homogeneous array of 24 elements (e.g. in C: float Readings[24] ) In main memory: … x + 23 Address of Readings[i] = x + (i-1)

Two-dimensional Arrays Sometimes 2-D homogeneous arrays are more useful (e.g. in C: float Table[4][5] ) => Address of Table[i][j] = x + (nr_of_columns × (i-1)) + (j - 1) => Example: address of Table[3][4] = x + 13

Opdracht: Suppose an array with 6 rows and 8 columns is stored starting at address 20. If each entry in the array requires only one memory cell, what is the address of the entry in the 3rd row and 4th column? What if each entry requires two cells? If 1 cell per entry: address at [3, 4] : 20 + 8 × (3-1) + (4-1) = 39. If 2 cells per entry: address at [3, 4] : 20 + 2 × (8 × (3-1) + (4-1)) = 58.

3D: place each 2D plane consecutively in memory Opdracht: Describe a method for storing 3-D homogeneous arrays. What addressing formula would be used to locate the entry in the i-th plane, the j-th row, and the k-th column? 2D: 3D: place each 2D plane consecutively in memory Addressing formula (with x as start address): x + r × c × (i - 1) + c × (j - 1) + (k - 1)

Lists To store an ordered list of names we could use 2-D homogeneous array (in C: char Names[10][8]) However: addition & removal of names requires expensive data movements!

Linked Lists Data movements can be avoided by using a ‘linked list’, including pointers to list entries

Deleting an Entry from a Linked List A list entry is removed by changing a single pointer:

Inserting an Entry into a Linked List A new entry is inserted by setting pointer of (1) new entry to address of entry that is to follow (2) preceding entry to address of new entry:

Opdracht: Which of the following routines correctly inserts 'NewEntry' immediately after the entry called 'PreviousEntry' in a linked list? Routine 1 1. Copy pointer field of 'PreviousEntry' into the pointer field of 'NewEntry'. 2. Change pointer field of 'PreviousEntry' to the address of 'NewEntry'. Routine 2 1. Change pointer field of 'PreviousEntry' to the address of 'NewEntry'. 2. Copy pointer field of 'PreviousEntry' into the pointer field of 'NewEntry'. Previous (1) (2) => routine 1 is correct

Disadvantage of contiguous array structures: Stacks Disadvantage of contiguous array structures: insertion / removal requires costly data movements Still okay if insertion / removal restricted to end of array: stack (with push & pop operations)

If maximum stack-size unknown: A Stack in Memory Here: conceptual structure close to identical to actual structure in memory If maximum stack-size unknown: pointers can be used ( => conceptual = actual structure )

Queues List where insertions take place at one end, and deletions at the other: ‘queue’ To serve ‘objects’ in the order of their arrival (waiting-line)

Problem with queue shown so far: Queue “crawling” (1) Problem with queue shown so far: queue moves downward in memory, destroying any other data in its path:

Queue “crawling” (2) Can be overcome by: circular movement of insertions / deletions through pre-designated area of memory: Conceptual view of circular queue

Many, many more possibilities Opdracht: Describe a data structure suitable for representing a board configuration during a chess game Simplest: 8×8 homogeneous array, where each entry contains one of the values {empty, king, queen, bishop, knight, rook, pawn} Other: 2×16 homogeneous array: 1st dimension used to distinguish between black / white; 2nd to enumerate remaining pieces of one color, incl. board position. To save memory space this 2nd dimension could be implemented as a linked list. Many, many more possibilities

Chapter 8 - Data Structures: Conclusions Pointers: basic aid in definition of dynamic data structures Often used data structures: Arrays (multi-dimensional) Lists (contiguous & linked) Stacks Queues (crawling & circular) Trees (not discussed…) …

‘C H A P T E R’ 9.5 (was chap. 8) File Structures Abstractions of the actual data organization on mass storage (hard disks, tapes, cd’s…) Again: differences between conceptual and actual data organization

Files, Directories & the Operating System OS storage structure: conceptual hierarchy of directories and files directory tree files

Files: Conceptual vs. Actual View View at OS-level is conceptual actual storage may differ significantly!

Text Files Sequential file consisting of long string of encoded characters (e.g. ASCII-code) But: character-string still interpreted by word processor! File in “Notepad” Same file in “MS Word”

From actual storage to conceptual view Interpretation by Application Program Sequential buffer sequential view Assembly by Operating System actual storage

Disadvantage of sequential files: Quick File Access Disadvantage of sequential files: no quick access to particular file data Two techniques to overcome this problem: (1) Indexing or (2) Hashing loaded into main memory when opened Indexing: Indexed File Index keys

Disadvantage of indexing is… the index Hashing Disadvantage of indexing is… the index requires extra space + includes 1 extra indirection Solution: ‘hashing’ finds position in file using a key value (as in indexing)… … simply by identifying location directly from the key How? define set of ‘buckets’ & ‘hash function’ that converts keys to bucket numbers … key value bucket number 0 1 2 3 … N hash function

Hash Function: Example If storage space divided into 40 buckets and hash function is division: key values 14, 54, & 94 all map onto same bucket (collision) Key values

Key field value can be anything

Handling Bucket Overflow When bucket-sizes are fixed: buckets can fill up and overflow One solution: designate special overflow storage area not fixed in size!

Opdracht: If we use division as a hash function and have 23 buckets, in which bucket should we search to find the record whose key is interpreted as the integer value 101? … 101 bucket number: 9 0 1 2 … 9 … 23 Division: 101 / 23 = 4, remainder 9

Opdracht: a) What advantage does an indexed file have over a hash file Opdracht: a) What advantage does an indexed file have over a hash file? b) What advantage does a hash file have over an indexed file? a) When key unique: index directly points to required data, while hashing oftens require an additional (sequential) bucket search (incl. bucket overflow). b) No additional index file storage is required.

Chapter 9.5 - File Structures: Conclusions abstractions of actual data organization on mass storage Changes of ‘view’: actual storage -> sequential view by OS -> conceptual view presented to user Quick access to particular file data by (1) indexing (2) hashing (requires no index, but requires bucket search!)

C H A P T E R 9 Database Structures (Large) integrated collections of data that can be accessed quickly Combination of data structures and file structures

Historical Perspective Originally: departments of large organizations stored all data separately in flat files Problems: redundancy & inconsistencies

Integrated Database System Better approach: integrate all data in a single system, to be accessed by all departments

Disadvantages of Data Integration Control of access to sensitive data?! Bijvoorbeeld: personeelszaken heeft niets te maken met persoonlijke gegevens opgeslagen door de bedrijfsarts! Misinterpretation of integrated data Supermarkt-database zegt dat een klant veel medicijnen koopt. Wat betekent dit? Wat als deze klant solliciteert op een baan bij de supermarkt-keten? What about the right to hold/collect/interpret data? Heeft een credit card company het recht gegevens over koopgedrag van personen te gebruiken/verkopen?

Conceptual Database Layers Operating System Actual data storage Data seen in terms of a sequential view Compare:

The Relational Model Relational Model shows data as being stored in rectangular tables, called relations, e.g.: row in a relation is called ‘tuple’ column in a relation is called ‘attribute’

Issues of Relational Design So, relations make up a relational database… … but this is not so straightforward: Problem: more than one concept combined in single relation

Redesign by extraction of 3 concepts Any information obtained by combining information from multiple relations

Example: Finding all departments in which employee 23Y34 has worked:

Relational Operations Extracting information from a relational database by way of relational operations Most important ones: (1) extract tuples (rows) : SELECT (2) extract attributes (columns) : PROJECT (3) combine relations : JOIN Such operations on relations produce other relations so: they can be used in combination, to create complex database requests (or ‘queries’)

The SELECT operation

The PROJECT operation

The JOIN operation

Opdracht: X relation U V W A Z 5 B D 3 C Q 5 Y relation R S 3 J 4 K RESULT X.U X.V X.W Y.R Y.S A Z 5 3 J A Z 5 4 K C Q 5 3 J C Q 5 4 K RESULT := PROJECT W from X JOIN X and Y where X.W > Y.R SELECT from X where W=5 PROJECT S from Y

Opdracht: PART relation MANUFACTURER relation Bolt 2X 1 PartName Weight Bolt 2X 1 Bolt 2Z 1.5 Nut V5 0.5 CompanyName PartName Cost Company X Bolt 2Z .03 Company X Nut V5 .01 Company Y Bolt 2X .02 Company Y Nut V5 .01 Company Y Bolt 2Z .04 Company Z Nut V5 .01 a) Which companies make Bolt 2Z? NEW := SELECT from MANUFACTURER where PartName = Bolt2Z RESULT := PROJECT CompanyName from NEW

Opdracht: PART relation MANUFACTURER relation Bolt 2X 1 PartName Weight Bolt 2X 1 Bolt 2Z 1.5 Nut V5 0.5 CompanyName PartName Cost Company X Bolt 2Z .03 Company X Nut V5 .01 Company Y Bolt 2X .02 Company Y Nut V5 .01 Company Y Bolt 2Z .04 Company Z Nut V5 .01 b) Obtain a list of the parts (+cost) made by Company X? NEW := SELECT from MANU’ER where CompanyName=CompanyX RESULT := PROJECT PartName, Cost from NEW

Opdracht: PART relation MANUFACTURER relation Bolt 2X 1 PartName Weight Bolt 2X 1 Bolt 2Z 1.5 Nut V5 0.5 CompanyName PartName Cost Company X Bolt 2Z .03 Company X Nut V5 .01 Company Y Bolt 2X .02 Company Y Nut V5 .01 Company Y Bolt 2Z .04 Company Z Nut V5 .01 c) Which companies make a part with weight 1? NEW1 := JOIN MANUCTURER and PART where MANUFACTURER.PartName = PART.PartName NEW2 := SELECT from NEW1 where PART.Weight = 1 RESULT := PROJECT MANU’ER.CompanyName from NEW2

Opdracht: PART relation MANUFACTURER relation Bolt 2X 1 PartName Weight Bolt 2X 1 Bolt 2Z 1.5 Nut V5 0.5 CompanyName PartName Cost Company X Bolt 2Z .03 Company X Nut V5 .01 Company Y Bolt 2X .02 Company Y Nut V5 .01 Company Y Bolt 2Z .04 Company Z Nut V5 .01 c) Which companies make a part with weight 1? NEW1 := SELECT from PART where Weight = 1 NEW2 := JOIN MANUCTURER and NEW1 where MANUFACTURER.PartName = NEW1.PartName RESULT := PROJECT MANU’ER.CompanyName from NEW2

Chapter 9 - Database Structures: Conclusions (large) integrated collections of data that can be accessed quickly Database Management System provides high-level view of actual data storage (database model) Relational Model most often used relational operations: SELECT, PROJECT, JOIN, … high-level language for database access: SQL

Overzicht Informatica – Tentamen (1) Most important sections (editie 8) & keywords: Ch. 0 - 1, 3, 4: abstractie / algoritme Ch. 1 - 1, 2, 4, 5, 6, 7: bits / data opslag & representatie (ASCII, etc) / Boolse operaties / flipflops / geheugen-vormen en -karakteristieken / getalstelsels (binair, hexadecimaal, etc…) / overflow & truncation errors Ch. 2 - 1, 2, 3, 4, 6: cpu architectuur / machine language & instructions / programma executie / machine cycle / alternatieve architecturen Ch. 3 - 1, 2, 3, 4: operating systems / batch processing / time-sharing / multitasking / OS componenten / process vs. programma / competition Ch. 4 - 1, 2, 3, 4: network topologies / bridges / routers / client-server / the internet / world wide web / network protocols / the grid

Overzicht Informatica – Tentamen (2) Most important sections (editie 8) & keywords: Ch. 5 - 1, 2, 4, 5, 6: algoritme (formeel) / primitiven / pseudo-code / syntax / semantiek / iteratie / loop control / recursie / efficientie Ch. 6 - 1, 2, 3, 4, 5: generaties: 1e, 2e, 3e / assembly language / compilers / machine independence / paradigma’s / imperatief / object-georienteerd / programming concepts / procedures / parameters / call by value/reference translation/compilation process Ch. 7 - 1, 2, 3: software life cycle / ontwikkelings-fase / modulariteit / koppeling / cohesie / documentatie / complexiteits-maat voor software Ch. 8 - 1, 2: datastructuren / abstractie / statisch vs. dynamisch / pointers / (arrays, lists, stacks, queues, etc…)

Overzicht Informatica – Tentamen (3) Most important sections (editie 8) & keywords: Ch. 9 - 1, 2, 5: databases vs. ‘platte’ files / relaties / tuples / attributen / relationele operaties: SELECT, PROJECT, JOIN / files / sequential / tekst / indexed / hashing Ch. 10 – 1, 3, 4: intelligent agents / Turing-test / production systems / search trees / heuristics / artificial neural networks / training vs test Ch. 11 – 1, 2, 4: computability / Turing Machines / the ‘halting’ problem Veel succes!