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
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:
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
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
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
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
nam
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
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
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
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 prep
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.
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 alphabe
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
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, mos
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 automat
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 finit
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
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 applic
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 e
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 co
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
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
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:
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
Internat
Object-Oriented
Programming
Object-Oriented Software Design
Responsibilities:
Divide the work into different actors, each with a different
responsibility. These actors become classes.
Independence:
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 o
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()
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
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 applicatio