Template Classes in C+
CS 1037a Topic 5
Related materials
from Main and Savitch Data Structures & other objects using C+
Sec. 6.1-6.2: Templated functions and classes
from CS1037 labs
Lab 4, using template Bag<Item>
5-2
Problems with Our Data Structures
Logic: An Introduction
Logic: An Introduction
1/8
Contents
What is logic?
History of logic
Why study logic?
Applications of logic to computer science
Logic: An Introduction
2/8
What is logic?
Logic is the Science of Reasoning
Etymology: Logykos (Greek) -
Propositional Language - Semantics
Lila Kari
The University of Western Ontario
Propositional Language - Semantics
CS2209, Applied Logic for Computer Science
1 / 15
Syntax and semantics
Syntax
Semantics
analyzes Form
analyzes Meaning
(p q) r - syntacticall
Propositional Calculus
Lila Kari
The University of Western Ontario
Propositional Calculus
CS2209: Applied Logic for Computer Science
1 / 30
Contents
What is a logical argument?
Some important logical arguments
Propositions
Logical connectives
Propositiona
Propositional Language - Syntax
Lila Kari
The University of Western Ontario
Propositional Language - Syntax
CS2209, Applied Logic for Computer Science
1 / 21
Propositional language
By using connectives, we can combine propositions,
whether they are atomi
UNIVERSITY OF WESTERN ONTARIO
Computer Science 2209b, Winter 2013-2014
Applied Logic for Computer Science
ASSIGNMENT 3
Given: Monday, March 3, Due: Monday March 10, 5:30pm
1) Use Liptons DNA algorithm to determine whether the following formula in
in the l
UNIVERSITY OF WESTERN ONTARIO
Computer Science 2209b, Winter 2013-2014
Applied Logic for Computer Science
ASSIGNMENT 2
Given: Monday, February 3, Due: Monday February 10, 5:00pm
1). Use the laws of propositional calculus to nd a formula in disjunctive nor
UNIVERSITY OF WESTERN ONTARIO
Computer Science 2209b, Winter 2013-2014
Applied Logic for Computer Science
ASSIGNMENT 4
Given: Monday, March 17, Due: Monday. March 24, 5pm
(1). Translate each of the following sentences into the language of the predicate
ca
UNIVERSITY OF WESTERN ONTARIO
Computer Science 2209b, Winter 2013-2014
Applied Logic for Computer Science
ASSIGNMENT 5
Given: Monday, March 31st, Due: Monday, April 7, 5:30pm
(1). Use formal deduction to prove the validity of the following argument:
Premi
Western University
Computer Science Department
CS 2209A: Applied Logic for Computer Science
Final 2012
Midterm
2:00pm - 5:00pm, Saturday, December 15, 2012
1. Translate each of the following sentences into the language of propositional calculus
using the
CS2210
Data Structures and Algorithms
Lecture 3:
ADTs and Javas interfaces
Instructor: Olga Veksler
2004 Goodrich, Tamassia
Outline
Data Structures
Abstract Data Types
2 Principles of OO Programming frequently
used for implementing ADT
encapsulation (inf
Notes on Complexity Analysis
1
Power Functions
For any a < b s.t. a 1 and b 1, it holds that nb is not O(na ). In other words, nb has a larger
growth rate than na .
Proof:
Argue by contradiction. Suppose nb is O(na ). Then there exist positive constants n
CS2210
Data Structures and Algorithms
Lecture 1: Course Overview
Instructor: Olga Veksler
2004 Goodrich, Tamassia
What is this course about?
We will study moderately complex data structures
and algorithms that are essential in core areas of
computer scie
Ordered Lists
CS 1037a Topic 10
Ordered List ADT
A list that is maintained in sorted order relies upon the relational operators "<=", "=", etc., being properly defined for the items in the list; this may require operator overloading in the item class Mos
Operator Overloading in C+
CS 1037a Topic 9
Some standard operators
some operators are defined for all basic types like int, float, char, (some are defined for pointers too)
operator+, operator-, operator+=, operator*, operator/ operator= (copy or assign
An Array-Based List ADT
CS 1037a Topic 8
The List ADT
A list is a linear structure Each item except the first (front, head) has a unique predecessor Each item except the last (end, tail) has a unique successor First item has no predecessor, and last item
Call Stack
CS 1037a Topic 7
Memory Organization in a Running Program
Memory available to a running program is divided into three parts:
The portion that holds the machinelanguage version of the program The heap: a pool of memory used for dynamic allocat
The Stack ADT
CS 1037a Topic 6
Related materials
from Main and Savitch Data Structures & other objects using C+
Sec. 7.1-7.3 (array-based implementation of Stack)
6-2
Stacks
Stack: a collection whose elements are added and removed from one end, called t
The Bag ADT
CS 1037a - Topic 4
Related materials
from Main and Savitch Data Structures & other objects using C+
Sec. 3.1: The bag class
from CS1037 labs
Lab 4
4-2
Bags
Bag: A collection of items in no particular order Items are retrieved from a bag in
Collections of Data
CS 1037a - Topic 3
Storing Data
Topic 2 showed many examples of how data (objects) can be stored in arrays
in most cases, very careful memory management had to be coded for proper allocation, access, and de-allocation
complex code h
Basic Memory Management and Pointers in C+
CS 1037a Topic 2
Overview:
part I
Pointers - a basic variable type
values of pointer variables (or pointers)
computer memory as a huge 1D array
basic operations with pointer variables Why pointers?
pointers
From Procedural Style to Basic Objects
CS 1037a Topic 1
What You Should Know
Variables, built-in types
int num_students = 64;
Arrays but just basics
int student_grades[64]; student_grades[7] = -100;
/ die cheater die
Procedures, if-else statements, loo
Computer Science 037a Final Examination
Part I: True/False and multiple choice answers. Circle your answers on the question sheet, and fill them in on the Scantron form 1. [1 mark] A stack is a first-in first-out data structure. a) True b) False 2. [1 mar
Computer Science 1037a Sample Questions for the Final Examination Part I: True/False and multiple choice answers. Circle your answers on the question sheet, and fill them in on the Scantron form 1. [1 mark] A list is a last-in first-out data structure. a)
1. Translate the following sentences into the language of propositional calculus using the indicated
notations for atomic formulas.
a. Harry is short, Bill is tall, and Marry is not blond. (, , )
b. Mary is sick () and it is raining () implies that Bob