Kernel Implementations I. 27 June 2013 OSU CSE 1

Size: px
Start display at page:

Download "Kernel Implementations I. 27 June 2013 OSU CSE 1"

Transcription

1 Kernel Implementations I 27 June 2013 OSU CSE 1

2 So, What s Inside the Computer? Consider any popular video game, e.g., Nintendo Wii bowling Are there bowling balls and bowling pins inside the game console s computer? 27 June 2013 OSU CSE 2

3 So, What s Inside the Computer? Consider any popular video game, e.g., Nintendo Wii bowling Are there bowling balls and bowling pins inside the game console s computer? Of course not! What s really inside the computer, then, that makes bowling-like behavior? 27 June 2013 OSU CSE 3

4 So, What s Inside the Computer? Consider any popular What video dynamic game, behavior e.g., Nintendo Wii bowling Are there bowling balls and and could bowling see inside pins the inside the game console computer computer? at any level of Of course not! A thought experiment: would you see if you had a magical magnifying glass detail while it s running? What s really inside the computer, then, that makes bowling-like behavior? 27 June 2013 OSU CSE 4

5 A Useful Metaphor 27 June 2013 OSU CSE 5

6 A Tower of Abstractions Bowling pins? Vectors? Numbers? Bits? Voltages? Electrons???? 27 June 2013 OSU CSE 6

7 A Tower of Abstractions Bowling pins? Vectors? Numbers? Bits? Voltages? Electrons???? These are all just mathematical models, i.e., abstractions used to explain and predict behavior. 27 June 2013 OSU CSE 7

8 A Tower of Abstractions Bowling pins? Vectors? Numbers? Bits? Voltages? Electrons???? Domain: Physics These models are supposed to match physical reality, and are discarded if they do not; limited by the physical world. 27 June 2013 OSU CSE 8

9 A Tower of Abstractions Bowling pins? Vectors? Numbers? Bits? Voltages? Electrons???? Domain: Computing These models are entirely artificial (need not match physical reality); limited only by the creativity of the software engineer. 27 June 2013 OSU CSE 9

10 A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? 27 June 2013 OSU CSE 10

11 A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? Numbers may be built on top of bits 27 June 2013 OSU CSE 11

12 A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? Bits may be built on top of voltages 27 June 2013 OSU CSE 12

13 A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? Voltages may be built on top of (?) electrons 27 June 2013 OSU CSE 13

14 Interpretation of Representation Let s not take the tower-building metaphor too far! A better approach is to think about interpreting a lower-level configuration (a.k.a. a representation) to get a higherlevel value 27 June 2013 OSU CSE 14

15 A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? (Configurations of) bits may be interpreted as numbers June 2013 OSU CSE 15

16 A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? (Configurations of) voltages may be interpreted as bits 27 June 2013 OSU CSE 16

17 A Tower of Abstractions Bowling pins Vectors Numbers Bits Voltages Electrons??? (Configurations of) electrons may be interpreted as voltages 27 June 2013 OSU CSE 17

18 First Example: QueueKernel For QueueKernel, one idea is to represent a Queue variable s value by using a java.util.list variable By convention (of the OSU CSE components), a kernel class that directly represents the new type using a component from the Java libraries that is very similar, has a name ending in L In this case, it is called Queue1L 27 June 2013 OSU CSE 18

19 Detailed Example: Queue1L What existing components (including builtin types of Java, and the Java libraries) could you build it on top of? In other words, what could you use as a data representation that could be interpreted as a Queue value? 27 June 2013 OSU CSE 19

20 Context of Queue1L Standard Iterable Has bodies for the constructor, plus the 7 methods from Standard and QueueKernel. QueueKernel Queue Queue1L extends extends implements QueueSecondary extends extends extends Object 27 June 2013 OSU CSE 20

21 Context of Queue1L newinstance clear transferfrom constructor enqueue dequeue length iterator Standard extends QueueKernel extends Queue extends Iterable Object implements QueueSecondary extends Queue1L extends 27 June 2013 OSU CSE 21

22 Instance Variables Each separate Queue1L object has its own distinct java.util.list variable that represents its object value Note: In the code we will examine for Queue1L, there is a declaration of a private instance variable whose value is the java.util.list that represents one Queue1L object (namely, this) 27 June 2013 OSU CSE 22

23 Instance Variables The adjective instance means there is a distinct variable (with the same name) for each instance (i.e., each distinct object) of the class in which it is declared. Each separate Queue1L object has its own distinct java.util.list variable that represents its object value Note: In the code we will examine for Queue1L, there is a declaration of a private instance variable whose value is the java.util.list that represents one Queue1L object (namely, this) 27 June 2013 OSU CSE 23

24 Let s Look at Queue1L.java 27 June 2013 OSU CSE 24

25 Other Representations? Is there any other way to use a java.util.list to represent an object value of type Queue? 27 June 2013 OSU CSE 25

26 Other Representations? Is there any other way to use a java.util.list to represent an object value of type Queue? Yes! What if you simply thought of the front of the Queue as being at the right end of the java.util.list rather than the left? How would the code change with this reversed interpretation? 27 June 2013 OSU CSE 26

27 Resources OSU CSE Components API: Queue 27 June 2013 OSU CSE 27

Kernel Implementations III. 6 May 2013 OSU CSE 1

Kernel Implementations III. 6 May 2013 OSU CSE 1 Kernel Implementations III 6 May 2013 OSU CSE 1 Implementing a Kernel Class From the examples so far, you should see there are two major questions to address: Q1: What data representation (a.k.a. data

More information

Java Interfaces. 6 April 2016 OSU CSE 1

Java Interfaces. 6 April 2016 OSU CSE 1 Java Interfaces 6 April 2016 OSU CSE 1 Conceptual Framework A firm conceptual foundation for understanding and designing modern software recognizes: Modern software consists of potentially large numbers

More information

More About Heaps. 14 June 2017 OSU CSE 1

More About Heaps. 14 June 2017 OSU CSE 1 More About Heaps 14 June 2017 OSU CSE 1 Complete Binary Tree As Array To use an Array to represent a complete binary tree, you need more information: An int index of the root of the tree of interest There

More information

Array. 9 January 2015 OSU CSE 1

Array. 9 January 2015 OSU CSE 1 Array 9 January 2015 OSU CSE 1 Array The Array component family allows you to manipulate arrays in a way that overcomes surprising limitations of built-in Java arrays, but retains the time/space performance

More information

Set4. 8 February 2019 OSU CSE 1

Set4. 8 February 2019 OSU CSE 1 Set4 8 February 2019 OSU CSE 1 Documenting Set4 (and Map4) By now you understand hashing and its benefits. But the algorithms we are using are not trivial, and make a lot of assumptions about the representation.

More information

CS201 - Assignment 7 Due: Wednesday April 16, at the beginning of class

CS201 - Assignment 7 Due: Wednesday April 16, at the beginning of class CS201 - Assignment 7 Due: Wednesday April 16, at the beginning of class http://xkcd.com/205/ For this assignment, we re going to be playing a bit with stacks and queues. Make sure you read through the

More information

CSE 373: Data Structures and Algorithms

CSE 373: Data Structures and Algorithms CSE 373: Data Structures and Algorithms Lecture 2: Wrap up Queues, Asymptotic Analysis, Proof by Induction Instructor: Lilian de Greef Quarter: Summer 2017 Today: Announcements Wrap up Queues Begin Asymptotic

More information

cs Java: lecture #6

cs Java: lecture #6 cs3101-003 Java: lecture #6 news: homework #5 due today little quiz today it s the last class! please return any textbooks you borrowed from me today s topics: interfaces recursion data structures threads

More information

Computer Science 62. Midterm Examination

Computer Science 62. Midterm Examination Computer Science 62 Bruce/Mawhorter Fall 16 Midterm Examination October 5, 2016 Question Points Score 1 15 2 10 3 10 4 8 5 9 TOTAL 52 Your name (Please print) 1. Suppose you are given a singly-linked list

More information

Repeated Arguments. 26 April 2013 OSU CSE 1

Repeated Arguments. 26 April 2013 OSU CSE 1 Repeated Arguments 26 April 2013 OSU CSE 1 Sources of Aliasing Aliased references for mutable types can cause trouble, so it is important to know how aliases might arise One way (which is easy to recognize

More information

Types and Static Type Checking (Introducing Micro-Haskell)

Types and Static Type Checking (Introducing Micro-Haskell) Types and Static (Introducing Micro-Haskell) Informatics 2A: Lecture 13 Alex Simpson School of Informatics University of Edinburgh als@inf.ed.ac.uk 16 October, 2012 1 / 21 1 Types 2 3 4 2 / 21 Thus far

More information

Types and Static Type Checking (Introducing Micro-Haskell)

Types and Static Type Checking (Introducing Micro-Haskell) Types and Static (Introducing Micro-Haskell) Informatics 2A: Lecture 14 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 17 October 2017 1 / 21 1 Types 2 3 4 2 / 21 So far in

More information

Stacks and Queues

Stacks and Queues Stacks and Queues 2-25-2009 1 Opening Discussion Let's look at solutions to the interclass problem. Do you have any questions about the reading? Do you have any questions about the assignment? Minute Essays

More information

CSE 331 Midterm Exam 2/13/12

CSE 331 Midterm Exam 2/13/12 Name There are 10 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. The exam is closed book, closed notes, closed

More information

Abstraction Functions Lecture 9 Fall 2005

Abstraction Functions Lecture 9 Fall 2005 Abstraction Functions 6.170 Lecture 9 Fall 2005 8.1 Introduction In this lecture, we turn to our second tool for understanding abstract data types: the abstraction function. The rep invariant describes

More information

Recursion is a fundamental programming technique that can provide an elegant solution certain kinds of problems. COMP Week 8 & 9 1

Recursion is a fundamental programming technique that can provide an elegant solution certain kinds of problems. COMP Week 8 & 9 1 Recursion is a fundamental programming technique that can provide an elegant solution certain kinds of problems COMP 202 - Week 8 & 9 1 A recursive definition is one which uses the word or concept being

More information

CMPS 240 Data Structures and Algorithms Test #2 Fall 2017 November 15

CMPS 240 Data Structures and Algorithms Test #2 Fall 2017 November 15 CMPS 240 Data Structures and Algorithms Test #2 Fall 2017 November 15 Name The test has six problems. You ll be graded on your best four answers. 1. Suppose that we wanted to modify the Java class NodeOutDeg1

More information

CSE 230 Computer Science II (Data Structure) Introduction

CSE 230 Computer Science II (Data Structure) Introduction CSE 230 Computer Science II (Data Structure) Introduction Fall 2017 Stony Brook University Instructor: Shebuti Rayana Basic Terminologies Data types Data structure Phases of S/W development Specification

More information

CSE143 Exam with answers Problem numbering may differ from the test as given. Midterm #2 February 16, 2001

CSE143 Exam with answers Problem numbering may differ from the test as given. Midterm #2 February 16, 2001 CSE143 Exam with answers Problem numbering may differ from the test as given. All multiple choice questions are equally weighted. You can generally assume that code shown in the questions is intended to

More information

Understanding an ADT implementation: Abstraction functions

Understanding an ADT implementation: Abstraction functions Understanding an ADT implementation: Abstraction functions CSE 331 University of Washington Michael Ernst Review: Connecting specifications and implementations Representation invariant: Object boolean

More information

This exam is open book. Each question is worth 3 points.

This exam is open book. Each question is worth 3 points. This exam is open book. Each question is worth 3 points. Page 1 / 15 Page 2 / 15 Page 3 / 12 Page 4 / 18 Page 5 / 15 Page 6 / 9 Page 7 / 12 Page 8 / 6 Total / 100 (maximum is 102) 1. Are you in CS101 or

More information

CSE373 Fall 2013, Second Midterm Examination November 15, 2013

CSE373 Fall 2013, Second Midterm Examination November 15, 2013 CSE373 Fall 2013, Second Midterm Examination November 15, 2013 Please do not turn the page until the bell rings. Rules: The exam is closed-book, closed-note, closed calculator, closed electronics. Please

More information

CS24 Week 4 Lecture 2

CS24 Week 4 Lecture 2 CS24 Week 4 Lecture 2 Kyle Dewey Overview Linked Lists Stacks Queues Linked Lists Linked Lists Idea: have each chunk (called a node) keep track of both a list element and another chunk Need to keep track

More information

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs.

Discover how to get up and running with the Java Development Environment and with the Eclipse IDE to create Java programs. Java SE11 Development Java is the most widely-used development language in the world today. It allows programmers to create objects that can interact with other objects to solve a problem. Explore Java

More information

Problem 1: Building and testing your own linked indexed list

Problem 1: Building and testing your own linked indexed list CSCI 200 Lab 8 Implementing a Linked Indexed List In this lab, you will be constructing a linked indexed list. You ll then use your list to build and test a new linked queue implementation. Objectives:

More information

Java Collections Framework. 24 April 2013 OSU CSE 1

Java Collections Framework. 24 April 2013 OSU CSE 1 Java Collections Framework 24 April 2013 OSU CSE 1 Overview The Java Collections Framework (JCF) is a group of interfaces and classes similar to the OSU CSE components The similarities will become clearly

More information

Stacks and Queues. Gregory D. Weber. CSCI C243 Data Structures

Stacks and Queues. Gregory D. Weber. CSCI C243 Data Structures Stacks and Queues Gregory D. Weber CSCI C243 Data Structures Principal Points 1. The Stack interface: how to declare it, what it does. 2. Generics: why they were added to Java, how to use them. 3. The

More information

Interfaces & Generics

Interfaces & Generics Interfaces & Generics CSC207 Winter 2018 The Programming Interface The "user" for almost all code is a programmer. That user wants to know:... what kinds of object your class represents... what actions

More information

Lecture 3: Queues, Testing, and Working with Code

Lecture 3: Queues, Testing, and Working with Code Lecture 3: Queues, Testing, and Working with Code Data Structures and Algorithms CSE 373 SU 18 BEN JONES 1 Clearing up Stacks CSE 373 SU 18 BEN JONES 2 Clearing up Stacks CSE 373 SU 18 BEN JONES 3 Clearing

More information

Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Thursday, April 25, 13

Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Queue Implemented with a CircularArray. Thursday, April 25, 13 Queue Implemented with 1 2 numitems = enqueue (); 1 Queue Implemented with 2 numitems = 2 enqueue (); enqueue (); 2 Queue Implemented with 2 numitems = 2 enqueue (); enqueue (); enqueue (5); enqueue (6);

More information

INSTITUTE OF AERONAUTICAL ENGINEERING

INSTITUTE OF AERONAUTICAL ENGINEERING INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad - 500 043 COMPUTER SCIENCE AND ENGINEERING TUTORIAL QUESTION BANK Course Name Course Code Class Branch DATA STRUCTURES ACS002 B. Tech

More information

Object Oriented Programming

Object Oriented Programming Unit 19: Object Oriented Unit code: K/601/1295 QCF Level 4: BTEC Higher National Credit value: 15 Aim To provide learners with an understanding of the principles of object oriented programming as an underpinning

More information

Basic Data Structures

Basic Data Structures Basic Data Structures Some Java Preliminaries Generics (aka parametrized types) is a Java mechanism that enables the implementation of collection ADTs that can store any type of data Stack s1

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today Introduction to Linked Lists Stacks and Queues using Linked Lists Next Time Iterative Algorithms on Linked Lists Reading:

More information

Examination Questions Midterm 1

Examination Questions Midterm 1 CS1102s Data Structures and Algorithms 10/2/2010 Examination Questions Midterm 1 This examination question booklet has 9 pages, including this cover page, and contains 15 questions. You have 40 minutes

More information

Where does the insert method place the new entry in the array? Assume array indexing starts from 0(zero).

Where does the insert method place the new entry in the array? Assume array indexing starts from 0(zero). Suppose we have a circular array implementation of the queue,with ten items in the queue stored at data[2] through data[11]. The current capacity of an array is 12. Where does the insert method place the

More information

Lecture 2: Implementing ADTs

Lecture 2: Implementing ADTs Lecture 2: Implementing ADTs Data Structures and Algorithms CSE 373 SP 18 - KASEY CHAMPION 1 Warm Up Discuss with your neighbors! From last lecture: - What is an ADT? - What is a data structure? From CSE

More information

Basic Data Structures 1 / 24

Basic Data Structures 1 / 24 Basic Data Structures 1 / 24 Outline 1 Some Java Preliminaries 2 Linked Lists 3 Bags 4 Queues 5 Stacks 6 Performance Characteristics 2 / 24 Some Java Preliminaries Generics (aka parametrized types) is

More information

PA3 Design Specification

PA3 Design Specification PA3 Teaching Data Structure 1. System Description The Data Structure Web application is written in JavaScript and HTML5. It has been divided into 9 pages: Singly linked page, Stack page, Postfix expression

More information

AS COMPUTERS AND THEIR USER INTERFACES have become easier to use,

AS COMPUTERS AND THEIR USER INTERFACES have become easier to use, AS COMPUTERS AND THEIR USER INTERFACES have become easier to use, they have also become more complex for programmers to deal with. You can write programs for a simple console-style user interface using

More information

CS161: Introduction to Computer Science Homework Assignment 10 Due: Monday 11/28 by 11:59pm

CS161: Introduction to Computer Science Homework Assignment 10 Due: Monday 11/28 by 11:59pm CS161: Introduction to Computer Science Homework Assignment 10 Due: Monday 11/28 by 11:59pm Many cable packages come with a search interface that let s you search for a show or movie by typing the name

More information

Linked Structures. See Section 3.2 of the text.

Linked Structures. See Section 3.2 of the text. Linked Structures See Section 3.2 of the text. First, notice that Java allows classes to be recursive, in the sense that a class can have an element which is itself an object of that class: class Person

More information

Computer Science 62. Bruce/Mawhorter Fall 16. Midterm Examination. October 5, Question Points Score TOTAL 52 SOLUTIONS. Your name (Please print)

Computer Science 62. Bruce/Mawhorter Fall 16. Midterm Examination. October 5, Question Points Score TOTAL 52 SOLUTIONS. Your name (Please print) Computer Science 62 Bruce/Mawhorter Fall 16 Midterm Examination October 5, 2016 Question Points Score 1 15 2 10 3 10 4 8 5 9 TOTAL 52 SOLUTIONS Your name (Please print) 1. Suppose you are given a singly-linked

More information

if (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 );

if (x == 0); System.out.println( x=0 ); if (x = 0) System.out.println( x=0 ); Sample Final Exam 1. Evaluate each of the following expressions and show the result and data type of each: Expression Value Data Type 14 % 5 1 / 2 + 1 / 3 + 1 / 4 4.0 / 2.0 Math.pow(2.0, 3.0) (double)(2

More information

XMLTree Model. 5 May 2016 OSU CSE 1

XMLTree Model. 5 May 2016 OSU CSE 1 XMLTree Model 5 May 2016 OSU CSE 1 XMLTree The XMLTree component family allows you to create, and navigate through, a tree whose structure mirrors that of an XML file The file from which the tree is created

More information

CSE 331 Midterm Exam Sample Solution 2/13/12

CSE 331 Midterm Exam Sample Solution 2/13/12 Question 1. (14 points) (assertions) Using backwards reasoning, find the weakest precondition for each sequence of statements and postcondition below. Insert appropriate assertions in each blank line.

More information

CSE 373: Homework 1. Queues and Testing Due: April 5th, 11:59 PM to Canvas

CSE 373: Homework 1. Queues and Testing Due: April 5th, 11:59 PM to Canvas CSE 373: Homework 1 Queues and Testing Due: April 5th, 11:59 PM to Canvas Introduction This homework will give you an opportunity to implement the Queue ADT over a linked list data structure. Additionally,

More information

CISC-124. This week we continued to look at some aspects of Java and how they relate to building reliable software.

CISC-124. This week we continued to look at some aspects of Java and how they relate to building reliable software. CISC-124 20180129 20180130 20180201 This week we continued to look at some aspects of Java and how they relate to building reliable software. Multi-Dimensional Arrays Like most languages, Java permits

More information

TypeScript. Types. CS144: Web Applications

TypeScript. Types. CS144: Web Applications TypeScript Superset of JavaScript (a.k.a. JavaScript++) to make it easier to program for largescale JavaScript projects New features: types, interfaces, decorators,... All additional TypeScript features

More information

8.1 Model building, verification, and validation

8.1 Model building, verification, and validation UNIT 8: VERIFICATION AND VALIDATION OF SIMULATION MODELS, OPTIMIZATION: Model building, verification and validation; Verification of simulation models; Calibration and validation of models. Optimization

More information

09/08/2017 CS2530 INTERMEDIATE COMPUTING 9/8/2017 FALL 2017 MICHAEL J. HOLMES UNIVERSITY OF NORTHERN IOWA TODAY S TOPIC: Exceptions and enumerations.

09/08/2017 CS2530 INTERMEDIATE COMPUTING 9/8/2017 FALL 2017 MICHAEL J. HOLMES UNIVERSITY OF NORTHERN IOWA TODAY S TOPIC: Exceptions and enumerations. CS2530 INTERMEDIATE COMPUTING 9/8/2017 FALL 2017 MICHAEL J. HOLMES UNIVERSITY OF NORTHERN IOWA TODAY S TOPIC: Exceptions and enumerations. 1 RUNTIME ERRORS All of us have experienced syntax errors. This

More information

Conditions, logical expressions, and selection. Introduction to control structures

Conditions, logical expressions, and selection. Introduction to control structures Conditions, logical expressions, and selection Introduction to control structures Flow of control In a program, statements execute in a particular order By default, statements are executed sequentially:

More information

double d0, d1, d2, d3; double * dp = new double[4]; double da[4];

double d0, d1, d2, d3; double * dp = new double[4]; double da[4]; All multiple choice questions are equally weighted. You can generally assume that code shown in the questions is intended to be syntactically correct, unless something in the question or one of the answers

More information

ARIZONA CTE CAREER PREPARATION STANDARDS & MEASUREMENT CRITERIA SOFTWARE DEVELOPMENT,

ARIZONA CTE CAREER PREPARATION STANDARDS & MEASUREMENT CRITERIA SOFTWARE DEVELOPMENT, SOFTWARE DEVELOPMENT, 15.1200.4 STANDARD 1.0 APPLY PROBLEM-SOLVING AND CRITICAL THINKING SKILLS TO INFORMATION 1.1 Describe methods of establishing priorities 1.2 Prepare a plan of work and schedule information

More information

Stacks and Queues. David Greenstein Monta Vista

Stacks and Queues. David Greenstein Monta Vista Stacks and Queues David Greenstein Monta Vista Stack vs Queue Stacks and queues are used for temporary storage, but in different situations Stacks are Used for handling nested structures: processing directories

More information

Papers we love - Utrecht

Papers we love - Utrecht Papers we love - Utrecht QuickCheck Wouter Swierstra 1 Requirements for a topic A paper that I love 2 Requirements for a topic A paper that I love A paper that is interesting to academics and developers

More information

Objects and Classes -- Introduction

Objects and Classes -- Introduction Objects and Classes -- Introduction Now that some low-level programming concepts have been established, we can examine objects in more detail Chapter 4 focuses on: the concept of objects the use of classes

More information

Objects and Iterators

Objects and Iterators Objects and Iterators Can We Have Data Structures With Generic Types? What s in a Bag? All our implementations of collections so far allowed for one data type for the entire collection To accommodate a

More information

CPSC 221: Algorithms and Data Structures Lecture #1: Stacks and Queues

CPSC 221: Algorithms and Data Structures Lecture #1: Stacks and Queues CPSC 221: Algorithms and Data Structures Lecture #1: Stacks and Queues Alan J. Hu (Slides borrowed from Steve Wolfman) Be sure to check course webpage! http://www.ugrad.cs.ubc.ca/~cs221 1 Lab 1 is available.

More information

Programming in Haskell Aug-Nov 2015

Programming in Haskell Aug-Nov 2015 Programming in Haskell Aug-Nov 2015 LECTURE 14 OCTOBER 1, 2015 S P SURESH CHENNAI MATHEMATICAL INSTITUTE Enumerated data types The data keyword is used to define new types data Bool = False True data Day

More information

Dynamic Data Structures

Dynamic Data Structures Dynamic Data Structures We have seen that the STL containers vector, deque, list, set and map can grow and shrink dynamically. We now examine how some of these containers can be implemented in C++. To

More information

Outline. 1 Hashing. 2 Separate-Chaining Symbol Table 2 / 13

Outline. 1 Hashing. 2 Separate-Chaining Symbol Table 2 / 13 Hash Tables 1 / 13 Outline 1 Hashing 2 Separate-Chaining Symbol Table 2 / 13 The basic idea is to save items in a key-indexed array, where the index is a function of the key Hash function provides a method

More information

CS18000: Programming I

CS18000: Programming I CS18000: Programming I Data Abstraction January 25, 2010 Prof. Chris Clifton Announcements Book is available (Draft 2.0) Syllabus updated with readings corresponding to new edition Lab consulting hours

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

EINDHOVEN UNIVERSITY OF TECHNOLOGY

EINDHOVEN UNIVERSITY OF TECHNOLOGY EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)

More information

Ruby: Introduction, Basics

Ruby: Introduction, Basics Ruby: Introduction, Basics Computer Science and Engineering College of Engineering The Ohio State University Lecture 3 Ruby vs Java: Similarities Imperative and object-oriented Classes and instances (ie

More information

Lecture 2: Stacks and Queues

Lecture 2: Stacks and Queues Lecture 2: Stacks and Queues CSE 373: Data Structures and Algorithms CSE 373 19 WI - KASEY CHAMPION 1 Warm Up 1. Grab a worksheet 2. Introduce yourself to your neighbors J 3. Discuss the answers 4. Log

More information

FINAL EXAMINATION. COMP-250: Introduction to Computer Science - Fall 2010

FINAL EXAMINATION. COMP-250: Introduction to Computer Science - Fall 2010 STUDENT NAME: STUDENT ID: McGill University Faculty of Science School of Computer Science FINAL EXAMINATION COMP-250: Introduction to Computer Science - Fall 2010 December 20, 2010 2:00-5:00 Examiner:

More information

Data Structure. Recitation VII

Data Structure. Recitation VII Data Structure Recitation VII Recursion: Stack trace Queue Topic animation Trace Recursive factorial Executes factorial(4) Step 9: return 24 Step 8: return 6 factorial(4) Step 0: executes factorial(4)

More information

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures

University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures University of Waterloo Department of Electrical and Computer Engineering ECE 250 Algorithms and Data Structures Final Examination (17 pages) Instructor: Douglas Harder April 14, 2004 9:00-12:00 Name (last,

More information

Object Oriented Programming and Design in Java. Session 19 Instructor: Bert Huang

Object Oriented Programming and Design in Java. Session 19 Instructor: Bert Huang Object Oriented Programming and Design in Java Session 19 Instructor: Bert Huang Announcements Homework 4 due MONDAY. Apr. 19 No multithreading in programming part Review Deadlocks and the Dining Philosophers

More information

CSCI 200 Lab 4 Evaluating infix arithmetic expressions

CSCI 200 Lab 4 Evaluating infix arithmetic expressions CSCI 200 Lab 4 Evaluating infix arithmetic expressions Please work with your current pair partner on this lab. There will be new pairs for the next lab. Preliminaries In this lab you will use stacks and

More information

CORK INSTITUTE OF TECHNOLOGY INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ. Electrical and Electronic Engineering

CORK INSTITUTE OF TECHNOLOGY INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ. Electrical and Electronic Engineering CORK INSTITUTE OF TECHNOLOGY INSTITIÚID TEICNEOLAÍOCHTA CHORCAÍ Module Title: Microcomputer Applications Module Code: MIAP E3001 School: Electrical and Electronic Engineering Programme Title: Bachelor

More information

Activity 6: Loops. Content Learning Objectives. Process Skill Goals

Activity 6: Loops. Content Learning Objectives. Process Skill Goals Activity 6: Loops Computers are often used to perform repetitive tasks. Running the same statements over and over again, without making any mistakes, is something that computers do very well. Content Learning

More information

Linked Lists

Linked Lists Linked Lists 2-17-2005 Opening Discussion What did we talk about last class? Do you have any code to show? Do you have any questions about the assignment? Can you tell me what a linked list is and what

More information

! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive)

! Determine if a number is odd or even. ! Determine if a number/character is in a range. - 1 to 10 (inclusive) - between a and z (inclusive) Final Exam Exercises Chapters 1-7 + 11 Write C++ code to:! Determine if a number is odd or even CS 2308 Fall 2018 Jill Seaman! Determine if a number/character is in a range - 1 to 10 (inclusive) - between

More information

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #23 Loops: Precedence of Operators

Introduction to Programming in C Department of Computer Science and Engineering. Lecture No. #23 Loops: Precedence of Operators Introduction to Programming in C Department of Computer Science and Engineering Lecture No. #23 Loops: Precedence of Operators This one more concept that we have to understand, before we really understand

More information

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University

CS 112 Introduction to Computing II. Wayne Snyder Computer Science Department Boston University CS 112 Introduction to Computing II Wayne Snyder Department Boston University Today: Fields vs local variables and scope Program Structure; the keyword static Classes vs objects Creating and using objects

More information

Computer Science First Exams Pseudocode Standard Data Structures Examples of Pseudocode

Computer Science First Exams Pseudocode Standard Data Structures Examples of Pseudocode Computer Science First Exams 2014 Pseudocode Standard Data Structures Examples of Pseudocode Candidates are NOT permitted to bring copies of this document to their examinations. 1 Introduction The purpose

More information

CS 206 Introduction to Computer Science II

CS 206 Introduction to Computer Science II CS 206 Introduction to Computer Science II 03 / 31 / 2017 Instructor: Michael Eckmann Today s Topics Questions? Comments? finish RadixSort implementation some applications of stack Priority Queues Michael

More information

CISC 323 Intro to Software Engineering

CISC 323 Intro to Software Engineering CISC 323 Intro to Software Engineering Topic 6: Design Patterns Readings in Custom Courseware, taken from Design Patterns: Elements of Reusable Object-Oriented Software by Gamma, Helm, Johnson, Vlissides

More information

Inheritance and Polymorphism

Inheritance and Polymorphism Inheritance and Polymorphism Inheritance (Continued) Polymorphism Polymorphism by inheritance Polymorphism by interfaces Reading for this lecture: L&L 10.1 10.3 1 Interface Hierarchies Inheritance can

More information

Motivation was to facilitate development of systems software, especially OS development.

Motivation was to facilitate development of systems software, especially OS development. A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.

More information

Topic 2. Collections

Topic 2. Collections Topic 2 Collections Objectives Define the concepts and terminology related to collections Discuss the abstract design of collections 2-2 Collections Collection: a group of items that we wish to treat as

More information

Queues. CITS2200 Data Structures and Algorithms. Topic 5

Queues. CITS2200 Data Structures and Algorithms. Topic 5 CITS2200 Data Structures and Algorithms Topic 5 Queues Implementations of the Queue ADT Queue specification Queue interface Block (array) representations of queues Recursive (linked) representations of

More information

Data Abstraction and Specification of ADTs

Data Abstraction and Specification of ADTs CITS2200 Data Structures and Algorithms Topic 4 Data Abstraction and Specification of ADTs Example The Reversal Problem and a non-adt solution Data abstraction Specifying ADTs Interfaces javadoc documentation

More information

CSE 143: Computer Programming II Spring 2015 HW7: 20 Questions (due Thursday, May 28, :30pm)

CSE 143: Computer Programming II Spring 2015 HW7: 20 Questions (due Thursday, May 28, :30pm) CSE 143: Computer Programming II Spring 2015 HW7: 20 Questions (due Thursday, May 28, 2015 11:30pm) This program focuses on binary trees and recursion. Turn in the following files using the link on the

More information

How can we improve this? Queues 6. Topological ordering: given a sequence of. should occur prior to b, provide a schedule. Queues 5.

How can we improve this? Queues 6. Topological ordering: given a sequence of. should occur prior to b, provide a schedule. Queues 5. Queues 1 Queues A Queue is a sequential organization of items in which the first element entered is the first removed. They are often referred to as FIFO, which stands for first in first out. Examples:

More information

COS 226 Algorithms and Data Structures Fall Midterm

COS 226 Algorithms and Data Structures Fall Midterm COS 226 Algorithms and Data Structures Fall 2017 Midterm This exam has 10 questions (including question 0) worth a total of 55 points. You have 0 minutes. This exam is preprocessed by a computer, so please

More information

Universal Game Controller

Universal Game Controller Universal Game Controller Neil Singh, Evan Lee, and Charles Van Fossan ECE 445 Project Proposal - Spring 2017 TA: Eric Clark 1 Introduction 1.1 Objective With the advancement of technology, the world of

More information

Compsci 290/Mobile, Java

Compsci 290/Mobile, Java Compsci 290/Mobile, Java Owen Astrachan Landon Cox January 16, 2018 1/16/2018 Mobile 290, Spring 2018, Java 1 Java Classes and Objects Class encapsulates state and behavior State is typically private Android

More information

l Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive)

l Determine if a number is odd or even l Determine if a number/character is in a range - 1 to 10 (inclusive) - between a and z (inclusive) Final Exam Exercises Chapters 1-7 + 11 Write C++ code to: l Determine if a number is odd or even CS 2308 Fall 2016 Jill Seaman l Determine if a number/character is in a range - 1 to 10 (inclusive) - between

More information

Java Classes - Using your classes. How the classes you write are being used

Java Classes - Using your classes. How the classes you write are being used Java Classes - Using your classes How the classes you write are being used What s the use of classes? So, you have been writing a few classes by now... What for? The programs you will write will use objects

More information

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide

AP Computer Science Chapter 10 Implementing and Using Classes Study Guide AP Computer Science Chapter 10 Implementing and Using Classes Study Guide 1. A class that uses a given class X is called a client of X. 2. Private features of a class can be directly accessed only within

More information

Activity 6: Loops. Content Learning Objectives. Process Skill Goals

Activity 6: Loops. Content Learning Objectives. Process Skill Goals Activity 6: Loops Computers are often used to perform repetitive tasks. Running the same statements over and over again, without making any mistakes, is something that computers do very well. Content Learning

More information

Pieter van den Hombergh Thijs Dorssers Richard van den Ham. May 17, 2018

Pieter van den Hombergh Thijs Dorssers Richard van den Ham. May 17, 2018 And And Pieter van den Hombergh Thijs Dorssers Richard van den Ham Fontys Hogeschool voor Techniek en Logistiek May 17, 2018 /FHTenL And May 17, 2018 1/14 And in /FHTenL And May 17, 2018 2/14 What is reflection

More information

CSE332 Summer 2012 Final Exam, August 15, 2012

CSE332 Summer 2012 Final Exam, August 15, 2012 Name: UW NetID: CSE332 Summer 2012 Final Exam, August 15, 2012 Please do not turn the page until the bell rings. Rules: The exam is closed-book and limited-note. You are permitted a single, handwritten

More information

Enums. In this article from my free Java 8 course, I will talk about the enum. Enums are constant values that can never be changed.

Enums. In this article from my free Java 8 course, I will talk about the enum. Enums are constant values that can never be changed. Enums Introduction In this article from my free Java 8 course, I will talk about the enum. Enums are constant values that can never be changed. The Final Tag To display why this is useful, I m going to

More information

Semantics of programming languages

Semantics of programming languages Semantics of programming languages Informatics 2A: Lecture 27 John Longley School of Informatics University of Edinburgh jrl@inf.ed.ac.uk 21 November, 2011 1 / 19 1 2 3 4 2 / 19 Semantics for programming

More information

Mobile Game Programming

Mobile Game Programming Mobile Game Programming Just that facts. guest instructor: Matt Meyer Introduction I Mobile Devices (Primary Purpose): Gaming Devices: Nintendo DS, PSP. Music Devices: ZUNE, IPod. Cellphone Devices: Nokia,

More information