CISC 320

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play

1/54

encourage image

There are no tags or description

Looks like no tags are added yet.

55 Terms

1
New cards

Three Criteria For Alogrithms (Lecture)

Correctness, Efficiency, Readability

2
New cards

Worst Case For Based Sorting (Lecture)

O (n log n)

3
New cards

Alogrithms (1)

A procedure that takes any of the possible input instances and transforms them into the desired output.

4
New cards

Problem

A specification of inputs and expected outputs they paired with, function contract, signature.

5
New cards

Problem: Robot Tour Optimization (1.1)

Input: A set S of n points in the plane

Output: What is the shortest cycle tour that visits each point in the set S?

OptimalTSP(P)

d=infinity

For each of the n! permutations P(i) if the point set O

if (cost(P(i)) <= d) then d = cost(P(i) and P(min) = P(i)

Return P min

Guarnteed shortest possible tour, but is extremely slow.

6
New cards

Problem: Movie Scheduling Problem (1.2)

Input: A set I intervals on the line.

Output: What is the largest subset of mutually non-overlapping intervals that can be selected from I?

Optimal Scheduling(I)

While (I ~= empty set)

Accept the job from h from I with the earliest completion date

Delete j, and any interval which intersects j, from I


7
New cards

Reasoning About Corretness (1.3)

We need tools to distingush corect algorithms from incorrect ones, the primary one of which is called a proof.

8
New cards

Proper Mathmatical Proof (1.3)

It consists of several parts: first, a clear, precise statement of what you're trying to prove. Second is a set of assumptions of things that are taken to be true and can be part of the proof, and third is the chain of reasoning that takes you from these assumptions to the statement you are trying to prove.

9
New cards

Problem Specification (1.3.1)

Has Two Parts: (1) the set of allowed input instances, and (2) the required properties of the algorithm’s output.

10
New cards

Verifability (1.3.3)

To demonstrate that a particular instance is a counterexample to a particular algorithm, you must be able to (1) calculate what answer your algorithm will give in this instance and (2) display a better answer so as to prove that the algorithm didn’t find it.

11
New cards

Simplicity (1.3.3)

A good counterexample has all unnecessary details stripped away. They make it clear exactly why the proposed algorithm fails. Simplicity is important because you must be able to hold the given instance in your head in order to reason about it. Once a counterexample has been found, it is worth simplifying it down to its essence.

12
New cards

Think exhaustively (1.3.3)

There are usually only a small number of possible instances for the first non-trivial value of n. For example there are only three distince ways two intervals on the line can occur: as disjoint intevals as overalloing intervals, and as properly nesting intervals, one within the other. All cases of three intervals (including counter examples, to be both of the movie heuristics) can be systematically constructed by adding a third segment in each possible way to these instances.

13
New cards

Hunt for weakness

If a proposed algorithm is of form “alwats take the biggest“ (better known as the greedy algorithm), htink about why that might prove to be the wrong thing to do in particular,…

14
New cards

Go for a tie

A devious way to break a greedy herusutc us to provide instances where everything is the same size. Suddenly the heurisitc has nothing to base its decision on, and perhaps has the fredom to return something suboptimal as the answer

15
New cards

Seek extremes

Many counter examples are mixtures of huge and tiny, left and right, few and many, near and far. It is usually easier to verify or reason about extreme examples, than more muddled ones. Consider two tightly bunched clouds of points seperated by a much larger distance d. The optimal TSP tour will be essentially 2d regardless of the number of points, because what happens within each cloud doesent really matter.

16
New cards

Recursion And Induction

A proof or demonstarte of corrects is often mathmatical induction.

17
New cards

Modeling (1.5)

Tge act if formulating your application in terms of precisely described, well understood problems. Proper modeling is the key to applying algorithmic design techniques to real world problems.

18
New cards

Proof By Contradiction (1.6)

Assume that the hypothesis (the statement you want to prove is false)

Develop Some logical consequence of this assumption

Show that one consequense is demonstrably false, thereby showing that the assumption is incorrect and the hypothesis is true.

19
New cards

War Story: Pyschic Handling 1.8 Theme

Make sure you model your problem correctly before trying to solve it.

20
New cards

Estimation 1.9

Principle Guessing, the ability to make back of the envelope estimates of diverse quantities such as the running time of a program is a valuable skill in algoruthmn design.

21
New cards

For a cmapus of n points hw many possible tours are there? It must hit every single point once (and only once), and also return to the starting point.

n!

22
New cards

RAM

Random Access Machine

23
New cards

Memory Acess

Each meemory acess takes exactly one time step.

24
New cards

RAM Model

Excellent model for understanding how an alogorithm will perform on a real computer.

25
New cards

Worst case complexity

Maximum number of steps taken in any instance of size in

26
New cards

Best Case complexity

Minimum number of steps taken un any instance of size n.

27
New cards

Average Case Complexity

Average number of steps over all instances of size n

28
New cards

2.9 War Story Theme

To show enmourmous potential for algorithmic speedups, as opposed to the fairly limited speedup obtainable via more expensive hardware.

29
New cards

3.1 Contiguous Data Strucutures

Allocated structures that are composed of single slabs of memory and includes arrays, matrices, heaps, and hash tables.

30
New cards

3.1 Linked Data Strucutures

Composed of distinct chunks of memeory bound together my pointers, and includes lists, trees, and graph adjacency lists.

31
New cards

3.1.1 Arrays

Fundamental contiguosly allocated data structure, fixed size data records that each element can be efficienty located by its index or equivalently address.

32
New cards

.1.1 Advantages of contiguously allocated arrays include:

Constant Time Acess Given The Index

Space Efficiency

Memory Locality

33
New cards

3.1.2 Pointers

The connc\ections that hold the pieces of linked structures together.

34
New cards

3.1.3 Advantages of Linked structures over static arrays include:

Overflow on linked structures never occurs unless memeory is actually full

Insertion and deletion are simpler than for static arrays

With large recrods, moving pointers is easier and faster than moving the items themselves

35
New cards

3.1.3 Advantages of arrays include

Space Effciency

Efficient random acess to items in arrays

Better memeory locality and cache performance than random pointer jumping

36
New cards

3.5 Priority Queues

An abstract data type that provides more flexibility than simple sorting, because it alows new elements to enter a system at arbitrary intervals.

37
New cards

3.6 War Story Theme

Using the greedy heuristic can significantly improve perfromance over the niave approach.

38
New cards

3.9 War Story Theme

Persistence Pays Off

39
New cards

List Scenario (Lecture)

I need elements at arbitrary positions

40
New cards

Queue Scenario (Lecture)

I need to get things order that they were placed

41
New cards

Map Scenario (Lecture)

I need to look up values by {name, phone number, space values}

42
New cards

List (Lecture)

A linear ordering of values that allows duplicates and random (arbitrary) access. (Linear ADT)

43
New cards

Queue (Lecture)

A sequence of items whic can be acessed first-in, first-cut(fifo). (Linear ADT)

44
New cards

Stack (Lecture)

A sequence of items which can be acessed last-in, first-out. (Linear ADT)

45
New cards

Dequeue (Lecture)

A sequence of items which can acessed from wither end. (Linear ADT)

46
New cards

Priority Queue (Lecture)

A set of items that can be acessed by their priority (Linear ADT)

47
New cards

Bag

Unordered collection of values (Unordered ADT)

48
New cards

Set

An unordered collection of values that does not allow duplicates (Unordered ADT)

49
New cards

Map

A colletion of unique keys associated with values (Unordered ADT)

50
New cards

Abstract Data Type (ADT)

Specification of an interface for a type, implies but does not gurantee data structure

51
New cards

Data structure

A concrete implemnetation of an ADT

52
New cards

Variable

An ADT, that stores name and value (name,value) and reads name that points to a value, (name)→value

53
New cards

Denominator grows quicker To Infinty

Big O notation

54
New cards

Numerator Grows Quicker To Infinity

Omega Notation

55
New cards

Big O And Omega Holds,

Ex: 2n/1n = 2 so Theta Notation