4n log n + 2n 3n + 100 log n n 2 + 10n
210 4n n3
2log n 2n n log n
210 2log n 3n + 100 log n 4n n log n 4n log n + 2n n 2 + 10n n3 2n
d ( n) is O( f ( n) and e( n) is O( g ( n), then the product d ( n)e( n) is O( f ( n) g ( n).
d ( n) O( f ( n) e( n) O( g
York University CSE 2011Z Winter 2010 Midterm Tues Feb 23
Instructor: James Elder 1. (5 marks) Big-Oh Denition Fill in the blanks: f (n) O(g (n) i c > 0, n0 > 0, such that n n0 , f (n) cg (n)
Answer: f (n) O(g (n) i c > 0, n0 > 0, such that n n0 , f (n)
Department of EECS
York University
Term: Fall 2014
Instructor: Andy Mirzaian
EECS2011: Fundamentals of Data Structures
Assignment 3
Due: 11 pm, Friday, November 14, 2014
Read the course FAQ on how to submit assignments electronically.
Print your name, c
York University
EECS 2001
November 25, 2016
Homework Assignment #10
Due: December 5, 2016 at 4:00 p.m.
1. Consider the context-free grammar G with starting symbol S and terminals a and b and
rules
S
S
S
S
S
Sa
bSS
SbS
SSb
a
Prove that every string generat
York University
EECS 2001
November 18, 2016
Homework Assignment #9
Due: November 24, 2016 at 4:00 p.m.
1. If L is a language over the alphabet , let ROOT (L) = cfw_x : n IN such that xn L.
(a) Let La = cfw_x cfw_a, b : the number of as in x is a multiple
EECS2001
ASSIGNMENT 2
DEADLINE: March 15, 2017
NOTES:
Assignments must be deposited in the EECS 2001 drop box before 6pm.
Assignments must have EECS 2001 cover page clearly indicating: your full
name, student number, the course name, and this assignment
CSE2001, Fall 2006
1
Last time we said that we would like to use mathematics to talk about algorithms and
to prove their properties. So, let us review some of the mathematical definitions and some
of the proof techniques required for this course.
Math Rev
CSE2001, Fall 2006
1
Modeling Computational Problems
Types of computational problems:
Decision problems: problems with a yes/no answer.
Function (or, input/output) problems: problems that require a more complex answer than yes/no.
We will focus on deci
1
CSE2001, Fall 2006
Non-Regular Languages, Pumping Lemma
To show that a language L is regular we can either
construct a DFA for L, or
construct an NFA for L, or
construct a regular expression for L.
How can we show that a language L is not regular ?
York University
EECS 2011Z Winter 2015 Problem Set 3
Instructor: James Elder
This problem set will not be graded, but will help you consolidate the material from the second half of
the course and prepare for the final exam. You are free to work together o
1
CSE2001, Fall 2006
Pumping Lemma (continued). Applications of Regular Expressions
and DFAs.
As we saw on the last lecture, we can use the Pumping Lemma to show that some
languages are not regular. Proof by contradiction:
Assume, by way of contradictio
CSE2001, Fall 2006
1
Deterministic Finite Automata (contd)
Definition: A deterministic finite automaton (DFA) M is a 5-tuple (Q, , , q0 , F ),
where
Q is a finite set of states;
is an input alphabet;
: Q 7 Q is a transition function;
q0 Q is the star
1
CSE2001, Fall 2006
Context-Free Grammars.
Motivation: some non-regular languages can be very naturally described using inductive (or, recursive) definitions.
Example 1: L1 = cfw_0n 1n | n 0 can be described as
L1 ,
if w L1 , then so is 0w1.
Example 2
CSE2001, Fall 2006
1
Regular Expressions
Regular expressions provide an alternative way to represent regular languages.
Practical uses: string pattern matching (e.g. grep, sed, awk, emacs, perl, most
of the modern text processors, search engines, etc.),
1
CSE2001, Fall 2006
Nondeterministic Finite Automata (continued)
Another new feature of NFAs: -transitions. Whenever an NFA arrives to the state
with an -transition, a new copy of the NFA is automatically created and this new
copy follows the transition
CSE2001, Fall 2006
1
Alphabets, Strings, Languages
Definition: An alphabet is a finite set of objects called symbols.
Notation: = cfw_a, b, . . . , z
Definition: A string over an alphabet is a finite sequence of symbols from .
Notation: w, x, y, . . . f
York University
EECS 2001
October 20, 2016
Homework Assignment #6
Due: October 31, 2016 at 4:00 p.m.
1. The textbook gives a high-level description of a Turing machine to decide the language
cfw_x cfw_0, 1 : x contains equal numbers of 0s and 1s in the an
Part 2: Summary
The Queue ADT and its interface in Java
General applications of queues
Array based implementation of queue:
Performance & Limitations
Comparison to java.util.Queue
Example applications:
Round Robin Schedulers
More algorithmic appli
1
Classification of
Programming Languages
Based on How They
Derive Machine Code
Compilers vs. Interpreters
2
Compiler computer program that transforms source code written
in one computer language to equivalent code in another
language
most commonly it is
Java Basics (cont.)
1
Classes & every object is an instance of a class
Objects
critical members of a class are:
instance variables = data associated with an object of
a class
method = a block of code that can be called to perform
actions - can be acces
Analysis of
Algorithms
Input
Algorithm
Output
Part 1:
Running Time
Running Time
Most algorithms transform input
objects into output objects.
The running time of an
algorithm typically grows with
the input size.
Average case time is often
difficult to d
Arrays &
Linked Lists
Part 1: Arrays
Array Definition
An array is a sequenced collection of variables
all of the same type. Each variable, or cell, in an
array has an index, which uniquely refers to the
value stored in that cell. The cells of an array, A
Recursion
Last Update: Oct 1, 2014
EECS2011: Recursion
1
The Recursion Pattern
Recursion:
when a method calls itself
Classic example: the factorial function
n! = 1*2*3 (n-1)*n
Recursive definition:
Last Update: Oct 1, 2014
EECS2011: Recursion
2
Content
Trees
What is a Tree
In computer science, a tree
is an abstract model of a
hierarchical structure
A tree consists of nodes
with a parent-child relation
Applications:
ComputersRUs
Sales
CAN
International
Organization charts
Europe
File systems
Progra
Object-Oriented
Programming
Object-Oriented Software Design
Responsibilities:
Divide the work into different actors, each with a different
responsibility. These actors become classes.
Independence:
Define the work for each class to be as independent fro
Part 3: Summary
From this part you should understand:
The purpose and advantages of the JCF
How interfaces, abstract classes and classes are used
hierarchically to achieve some of the key goals of objectoriented software engineering.
iterators: purpose
Priority Queues
Priority Queue ADT
A priority queue stores a
collection of entries
Each entry is a pair (key, value)
Main methods:
insert(k, v)
inserts an entry with key k and
value v
removeMin()
removes and returns the entry
with smallest key, or nu
Maps,
Hash Tables,
Skip Lists,
Sets
Maps & Dictionaries
Maps
A map models a searchable collection of key-value entries
The main operations of a map are for searching, inserting,
and deleting entries
Multiple entries with the same key are not allowed
A
Summary
The Tree ADT, tree terminologies, and Java interface
Tree Traversals
Preorder
Postorder
Inorder
Euler Tour
Level order (aka, breadth first search)
Binary trees: properties & some applications
Linked list & array based representations of trees.