CS3334 Lecture 1

Lecture 1: Complexity Analysis

How to measure Running time: Use a function to model the running time of a program or procedure.

  • Assume an abstract machine and count the number of “steps” executed by an algorithm

Function: In mathematics, a function is a relation between a set of inputs and a set of allowed outputs with the property that each input is related to exactly one output

How to Model Running Time as a function:

Compare the functions of Running Time models:

Consider the order of growth of running time, not the actual value

The order of growth rate

  • Give a simple characterization of the algorithm’s efficiency
  • Allow us to compare the relative performance of alternative algorithms

In the analysis of algorithms, we need to consider the performance of algorithms when applied to very very big input datasets, e.g., very large n (i.e., asymptotic analysis)

TA(n) = 100n + 50

TB(n) = (0.5)n2 + 4.5n + 5

TA(n) > TB(n) if n < c,   but TA(n) < TB(n) if n > c

Asymptotic Notation - notations to express the growth rate of a function (Just for function)

A way to compare ‘size‘ of functions:

– ο-notation (“Big-oh”) ≈≤ (upper bound)

– Ω-notation (“Big-omega”) ≈≥ (lower bound)

– θ-notation (“theta”) ≈= (in between)

原文地址:https://www.cnblogs.com/charon922/p/8320028.html

时间: 2024-11-01 15:25:21

CS3334 Lecture 1的相关文章

CS3334 Lecture 3

Arrays, Linked Lists, Stacks & Queues Introduction Efficiency is important Focus on main memory data storage; data storage in secondary storage (e.g., hard disks and databases) is usually called indexing structures Array Array is a data structure tha

codeforces 499B.Lecture 解题报告

题目链接:http://codeforces.com/problemset/problem/499/B 题目意思:给出两种语言下 m 个单词表(word1, word2)的一一对应,以及 professor's lecture 的 n 个单词.问记下来的笔记是什么.对于professor's lecture 的某个单词,如果在单词表中找到,word1, word2 都有可能.如果 word1 的长度  <= word2 的长度,就输出word1,否则word2 考了map<string, st

Learning OpenCV Lecture 4 (Transforming Images with Morphological Operations)

In this chapter, we will cover: Eroding and dilating images using morphological filters Opening and closing images using morphological filters Detecting edges and corners using morphological filters Segmenting images using watersheds 分水岭算法 Extracting

Learning OpenCV Lecture 5 (Filtering the Images)

In this chapter, we will cover: Filtering images using low-pass filters Filtering images using a median filter Applying directional filters to detect edges Computing the Laplacian of an image 图像各有不同因为他们有不一样的灰度级分布.如天空的灰度级不怎么变化,但是在一个对象非常多的图像里面,灰度级变化非常剧

C++基本要点复习--------coursera程序设计实习(PKU)的lecture notes

因为一些特性复杂,很多时候也用不到一些特性,所以忘记了,算是随笔,也当作一个临时查找的手册.没有什么顺序,很杂. 1.构造函数通过函数重载的机制可以有多个(不同的构造函数,参数个数,或者参数类型不同.),但是析构函数只能有一个.当没有在代码中写明构造或析构函数时,编译器会自动生成缺省的构造或析构函数.构造函数和析构函数都无返回值.另外,析构函数必须无参数.没写复制(拷贝)构造函数,编译器也会自动生成缺省的复制构造函数.复制构造函数会生成一个临时隐藏的对象,在调用一个以类对象作为参数的函数和调用一

Codefources 519E. A and B and Lecture Rooms LCA

简单LCA: 求树上距离给定两个点a,b距离相等的点有多少个 先预处理出每个节点的孩子个数sum[x],求出a,b的LCA,根据深度就可以知道两个点的距离,距离为偶数的有解.... 根据lca在a,b之间的位置不同分情况讨论: 设a与lca距离为 ha , b与lca距离为 hb 1:lca在a,b正中间既a,b分别属于lca的两个子树中, 结果为: n-sum[ a往上距离lca ha-1 的点] - sum[ b往上距离lca hb-1 的点] 2:a,b两个点相对lca一上一下. c:a,

Learning OpenCV Lecture 6 (Extracting Lines,Contours, and Components)

In this chapter, we will cover: Detecting image contours with the Canny operator Detecting lines in images with the Hough transform Fitting a line to a set of points Extracting the components' contours Computing components' shape descriptors Detectin

Learning OpenCV Lecture 3 (Counting the Pixels with Histograms)

In this chapter, we will cover: Computing the image histogram Applying look-up tables to modify image appearance Equalizing the image histogram Backprojecting a histogram to detect specific image content Using the mean shift algorithm to find an obje

Learning OpenCV Lecture 2 (Using the Strategy pattern in algorithm design)

ColorDetector.h: #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> class ColorDetector { public: // empty constructor ColorDetector() : minDist(100) { // default parameter initialization here target[0] = target[1] = targe