编程辅导 COMP 3711 Design and Analysis of Algorithms

GET ANSWERS AT ESSAYLINK.NET

COMP 3711 Design and Analysis of Algorithms
Lecture 1: Course Mechanics Review of Asymptotic Notations

• Lectures • L1

Copyright By PowCoder代写 加微信 powcoder

COMP3711 –Basics
• Tuesday & Thursday, 16:30 – 17:50
• Zoom Meeting ID: 927 5139 3911
• Monday 13:30-14:50,
• Zoom Meeting ID: 960 0689 7256 • Friday 9:00 – 10:00
• Zoom Meeting ID: 957 2701 1117 • Instructor: Professor Dimitris Papadias
• https://www.cse.ust.hk/~dimitris
• Tutorials (links to be announced) • T1: Tuesday, 18:00 – 18:50
• Zoom Meeting ID: 914 1942 5408 • T2: Friday, 15:30 – 16:20
• Zoom Meeting ID: 960 0689 7256 • T3: TBA
First Tutorial on Tuesday, Feb 15, 2022

Topics Covered (tentative)
• Techniques (with multiple examples)
• Divide & Conquer
• Greedy Algorithm Design
• Dynamic Programming
• Basic Randomized Algorithms
• Graph Algorithms
• Breadth & Depth First Search
• Shortest Paths
• Spanning Trees
• Maximum Flow and Bipartite Matchings
• Extra topics (if time available)
• AVL Trees
• Basic String Matching

About the Class
• What this class is
• Learning algorithmic techniques to solve problems.
• Learning how to prove correctness of algorithms.
• Learning how to model problems.
• What this class isn’t • Coding.
• Language specific programming hacks.

Prerequisites
• COMP2711 – Discrete Math • In particular
Basic Formulas, e.g., formulas for ,
􏰈, geometric
Basic Combinatorics, e.g, =
• COMP 2011 – Basic Data Structures • In particular
• Linked Lists (singly and doubly)
• Stacks and Queues
• Binary (Search) Trees

Accessing Course Material
The CANVAS system is used for COMP3711.
Assignments will be given out via canvas. All assignments must be submitted online via canvas. Hard copies will not be accepted. Email submissions will not be accepted. Late submissions will not accepted without prior approval.
Until further notice, all teaching will be online using Zoom
• The zoom meeting information for COMP 3711 is given on the canvas course page.
• Links to lecture recordings will also be posted on the canvas course page.

Tentative Grading Scheme
• 50% Written Assignments • 4-5 written assignments
• Assignments are a combination of problems that require you to work through taught algorithms on given input and problems that require you to design new algorithms
• Submission will be online via Canvas. You can typeset your solution, or scan your handwritten solutions, take pictures of your handwritten solutions.
• 50% Final Exam
• Will cover the entire semester’s material. Format not finalized yet.

Office Hours
• Office hours will be Zoom meetings by appointment
• Please feel free to email the instructor or your TAs to set up an
appointment
• If we receive multiple requests for appointments, especially
about similar topics, we might hold group meetings

Course Policies
• Making up Missed Finals
• Only for medical reasons (with Doctor’s note)
• OR prior approval of instructor, e.g., need to be away for academic competition
• Assignments
• Plagiarism: While collaboration is allowed,
• Assignment solutions must be written in your own words (not copied or modified from someone else’s write-up).
• You must understand your solution and its derivation. (We may ask you to explain it.)
• You must explicitly acknowledge in writing in the assignment your collaborators (whether or not they are classmates) or any other outside sources on each assignment.
• Failing to do any of these will be considered plagiarism, and may result in a failing grade in the course and notification for appropriate disciplinary action.

Review Material – Input Size of Problems
The input size indicates how large the input is. Since we assume that any number can be stored in a computer word and each arithmetic operation takes constant time, we take the number of items in the input as the input size (instead of bits).
By an item, we mean something that can be represented by a number and so it can be stored using one computer word.
Examples: Sorting
Graph problems Searching
Size of the list or array Numbers of vertices and edges Number of input keys

Measuring Running Time using Asymptotic Notation
Throughout the class we will measure the running time/cost of algorithms
 as a function of input size:
 using the number of instructions/steps/operations (e.g., comparisons
between two numbers)
 using asymptotic notation, which ignores constants and non-dominant
growth terms.
Which algorithm is better for large ?
For Algorithm 1, For Algorithm 2,
 Clearly, Algorithm 2 is better for large inputs

Behavior of some Commonly Encountered Functions
1,073,741,824
20,971,520
1,000,000,000,000

Asymptotic Notation: Quick Revision
Upper bounds.
ifexistconstants𝑐>0and𝑛00suchthatforall𝑛𝑛0, 𝑇 𝑛 ≤𝑐·𝑓(𝑛).
Lower bounds.  ifexistconstants𝑐>0and𝑛00suchthatforall𝑛𝑛0, 𝑇 𝑛 ≥𝑐·𝑓(𝑛).
Tight bounds. 
if 𝑇 𝑛 = 𝑂(𝑓(𝑛))and 𝑇 𝑛 = (𝑓(𝑛)).
Note: Here “=” means “is”, not equal.

Big-O Notation
Big-O notation is a mathematical notation for upper-bounding a function’s rate of growth.
T(n) = O(g(n))
∃c,n0 >0s.t.∀n≥n0, 0 ≤ T(n) ≤ c⋅g(n)
T(n) describes the running time of an algorithm.
T(n) = O(g(n)) means that there exists some c and n0 such that the pink line given by c⋅g(n) is above the yellow line for all values to the right of n0.

Big-O Notation
T(n) = O(g(n))
∃c,n0 >0s.t.∀n≥n0, 0 ≤ T(n) ≤ c⋅g(n)
T(n) doesn’t always have to be linear.

Big-O Notation
T(n) = O(g(n))
∃c,n0 >0s.t.∀n≥n0, 0 ≤ T(n) ≤ c⋅g(n)
T(n) and g(n) do not always T(n) have to be increasing.
Here, any choice for n0 is OK.

Big-O Notation Proofs
● Big-O is the most common notation because it is used to provide an upper bound for the cost of algorithms in the worst case
● To prove T(n) = O(g(n)), show that there exists c and n0 that satisfies the definition.
○ For example,
Suppose T(n) = n and g(n) = n log(n). We prove that T(n) =
Selectthevaluesc=1andn0 =2.Wehaven≤cnlog(n)for n≥n0 sincenispositiveand1≤lognforn≥2.
T(n) = O(g(n))
∃c,n0 >0s.t.∀n≥n0, 0 ≤ T(n) ≤ c⋅g(n)

Big-O Notation Proofs
● To prove T(n) ≠ O(g(n)), proceed by contradiction. ○ For example,
Suppose T(n) = n2 and g(n) = n. We prove that T(n) ≠ O(g(n)).
Suppose there exists some c and n0 such that for all n ≥ n0, n2 ≤cn.Then,n≤c, n≥n0, whichisnotpossiblebecausec is a constant and n can be arbitrarily large.
T(n) = O(g(n))
∃c,n0 >0s.t.∀n≥n0, 0 ≤ T(n) ≤ c⋅g(n)

Big-Ω Notation
● Big-Ω notation is a mathematical notation for lower-bounding a function’s rate of growth.
● Let T(n), g(n) be functions of positive integers.
○ You can think of T(n) as being a runtime: positive and
increasing as a function of n.
● We say “T(n) is Ω(g(n))” if g(n) grows at most as fast as T(n) as n gets large. Formally,
T(n) = Ω(g(n)) iff
c,n0 >0s.t. n≥n0, 0 ≤ c g(n) ≤ T(n)

Big-Ω Notation
T(n) = Ω(g(n)) iff
∃c,n0 >0s.t.∀n≥ n0,
0 ≤ c⋅g(n) ≤ T(n)
Big-Ω defines “T(n) = Ω(g(n))” to mean there exists some c and n0 such that the pink line given by c⋅g(n) is below the yellow line for all values to the
c g(n) right of n0.

Big-Θ Notation
We say “T(n) is Θ(g(n))” iff T(n) = O(g(n)) AND T(n) is Ω(g(n)) c’ g(n)

Discussion about constants and non-dominant growth terms
Asymptotic notations ignore constants and non-dominant growth terms.
If the number of steps taken by an algorithm A is and another algorithm B is , then both have Θ(n) running time, but algorithm A is superior in practice.
If two algorithms have the same asymptotic running time, implementation and experimentation is necessary to determine the best.
Nevertheless if algorithm A is asymptotically slower than B, then A is very likely to be (much) slower than B in practice.

Sorting Example
Population
Insertion Sort
Merge Sort
Macau (0.5M)
China (1357M)

Basic Facts on Exponents and Logarithms
c-n=1/cn ———-> c-1=1/c
c1/n=nc ———-> c1/2=c
(cm)n=(cn)m=cnm ———-> 22n = (2n)2  (2n); set x=2n, then x2  (x) cmcn=cn+m ———-> 2n+2 = 222n =(2n); (2n+c)=(2n)
logc(ab) = logca + logcb
logc(ba) =alogcb ———-> log(n3)=3logn=(logn) In general, log(nc)=(logn)
logba = logca/logcb ——–> log10n=log2n/log210 =(logn) (log210 is constant) In general, the base of the logarithm is not important and logcn=(logn)
logc(1/a) = logc(a−1) = −logca logba = logaa/logab = 1/logab
alogbn= nlogba ——–> 4logn = nlog4 = n2

Important note on growth of functions
constant set m=logn, then logm= O(m)
􏰇.􏰆 􏰆􏰇 􏰆􏰇􏰇

Exercise 1
Note: constant CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com

The post 编程辅导 COMP 3711 Design and Analysis of Algorithms appeared first on PowCoder代写.

GET ANSWERS AT ESSAYLINK.NET

编程辅导 COMP 3711 Design and Analysis of Algorithms
Scroll to top