COMP 9020 - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

COMP 9020

Description:

Many languages have come and gone. Many languages will be ... new piece of ... implemented by simply adding the new piece of data to the end of the ... – PowerPoint PPT presentation

Number of Views:89
Avg rating:3.0/5.0
Slides: 22
Provided by: cse13
Category:
Tags: comp

less

Transcript and Presenter's Notes

Title: COMP 9020


1
COMP 9020
  • Dr. Rex Kwok
  • Mondays 3-6pm
  • OMB 31

2
Motivation
  • Proliferation of programming languages
  • Many languages have come and gone
  • Many languages will be developed in the future
  • Logic and mathematics as a means of reasoning and
    analysis

3
Course Overview
  • Reasoning with logic
  • Means of representing beliefs/knowledge
  • Derivation of consequences
  • Reasoning with sets and relations
  • Complexity and order of growth

4
Course Overview
  • Counting and probability
  • Common data structures
  • Trees
  • Graphs

5
Assessment
  • Two assignments worth 20 each
  • Applications of theory
  • Sorting algorithms?
  • Bioinformatics, evolutionary genetics?
  • A final exam worth 60

6
Resources
  • http//www.cse.unsw.edu.au/cs9020/
  • lecture material
  • practice questions and solutions

7
Textbooks
  • The lecture material comes from Discrete
    Mathematics by K.A. Ross and C.R.B. Wright.
  • Other references are Logic and Discrete
    Mathematics A Computer Science Perspective by
    W.K. Grassmann and J. Tremblay.
  • and Foundations of Computer Science C Edition by
    A.V. Aho and J.D. Ullman.

8
Example The Priority Queue
  • Data
  • key which is used to identify or rank an object
  • e.g. student number, a persons height,
    intelligence etc.
  • Operations
  • addKey adds a new piece of data
  • findMin is an operation which returns the object
    with the smallest key

9
An unordered array
  • addKey is implemented by simply adding the new
    piece of data to the end of the list.

addKey(27)
10
An unordered array
  • Implement findMin in the following way
  • set the leftmost element as the current candidate
    for the smallest key
  • traverse the array from left to right updating
    the candidate as required

11
An unordered array
  • In every case, the search has to continue to the
    end of the array
  • If there are n keys, findMin requires n-1
    comparison operations are necessary
  • addKey does not require any comparison operations

12
A heap
  • A heap is a complete binary tree with the
    property that all for every node v (except the
    root), the key at v is greater than the key of
    the parent of v

13
A heap
4
11
24
34
16
51
97
71
36
14
A heap
4
11
24
34
16
51
97
71
36
1
15
A heap
4
11
24
34
16
1
97
71
36
51
16
A heap
4
11
1
34
16
24
97
71
36
51
17
A heap
1
11
4
34
16
24
97
71
36
51
18
Consequences of the heap property
  • The smallest key is always held at the root node
  • findMin does not require any comparison
    operations
  • With n keys the height of the heap is log2n
  • addKey in the worst case requires log2n
    comparisons

19
Venn Diagrams
B
A
B
A
A ? B
A ? B
20
Venn Diagrams
B
B
A
A
A \ B
A B
21
Venn Diagrams
A
Ac
Write a Comment
User Comments (0)
About PowerShow.com