datastructures - cinvestav · outline 1 introduction 2 linkedlists 3 multidimensionalarrays 4...

63
Data Structures Syllabus Andres Mendez-Vazquez December 3, 2015 1 / 17

Upload: others

Post on 09-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Data StructuresSyllabus

Andres Mendez-Vazquez

December 3, 2015

1 / 17

Page 2: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Outline1 Introduction2 Linked Lists3 Multidimensional Arrays4 Stacks5 Queues6 Trees7 Priority Queues8 Dictionary Data Structures9 Disjoint Set Representation10 Graphs11 Divide and Conquer12 Greedy Method13 Dynamic Programming14 Backtracking

2 / 17

Page 3: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Introduction

Subjects1 Course Overview2 Insertion Sort for practical Complexities3 Run Time Measurements4 Data Representation: Abstract Data Types

3 / 17

Page 4: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Introduction

Subjects1 Course Overview2 Insertion Sort for practical Complexities3 Run Time Measurements4 Data Representation: Abstract Data Types

3 / 17

Page 5: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Introduction

Subjects1 Course Overview2 Insertion Sort for practical Complexities3 Run Time Measurements4 Data Representation: Abstract Data Types

3 / 17

Page 6: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Introduction

Subjects1 Course Overview2 Insertion Sort for practical Complexities3 Run Time Measurements4 Data Representation: Abstract Data Types

3 / 17

Page 7: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Introduction

Subjects1 Course Overview2 Insertion Sort for practical Complexities3 Run Time Measurements4 Data Representation: Abstract Data Types

3 / 17

Page 8: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Linked Lists

We will seeAbstract Data Types for Linear List

Representation IUsing Arrays as

a b c d e - - - -0 1 2 3 4 5 6 7 8

Representation IILink Lists as

4 / 17

Page 9: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Linked Lists

We will seeAbstract Data Types for Linear List

Representation IUsing Arrays as

a b c d e - - - -0 1 2 3 4 5 6 7 8

Representation IILink Lists as

4 / 17

Page 10: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Linked ListsWe will seeAbstract Data Types for Linear List

Representation IUsing Arrays as

a b c d e - - - -0 1 2 3 4 5 6 7 8

Representation IILink Lists as

C A E D B

firstNode

4 / 17

Page 11: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Multidimensional Arrays

We will see stuff like1 Row-major and column-major indexing2 Special Matrices3 Sparse Matrices

To build structures like this ones

5 / 17

Page 12: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Multidimensional Arrays

We will see stuff like1 Row-major and column-major indexing2 Special Matrices3 Sparse Matrices

To build structures like this ones

5 / 17

Page 13: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Multidimensional Arrays

We will see stuff like1 Row-major and column-major indexing2 Special Matrices3 Sparse Matrices

To build structures like this ones

5 / 17

Page 14: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Multidimensional Arrays

We will see stuff like1 Row-major and column-major indexing2 Special Matrices3 Sparse Matrices

To build structures like this ones

5 / 17

Page 15: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Stacks

We will see stuff like1 LIFO Structure2 Operations: Removing and adding at the top3 Stack Implementations4 Applications

To solve problems like

6 / 17

Page 16: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Stacks

We will see stuff like1 LIFO Structure2 Operations: Removing and adding at the top3 Stack Implementations4 Applications

To solve problems like

6 / 17

Page 17: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Stacks

We will see stuff like1 LIFO Structure2 Operations: Removing and adding at the top3 Stack Implementations4 Applications

To solve problems like

6 / 17

Page 18: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Stacks

We will see stuff like1 LIFO Structure2 Operations: Removing and adding at the top3 Stack Implementations4 Applications

To solve problems like

6 / 17

Page 19: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

StacksWe will see stuff like

1 LIFO Structure2 Operations: Removing and adding at the top3 Stack Implementations4 Applications

To solve problems like

6 / 17

Page 20: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Queues

We will see stuff like1 FIFO Structure2 Operations: Queue, dequeue, etc3 Queue Implementation4 Applications

To implement, for example, schedulers

7 / 17

Page 21: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Queues

We will see stuff like1 FIFO Structure2 Operations: Queue, dequeue, etc3 Queue Implementation4 Applications

To implement, for example, schedulers

7 / 17

Page 22: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Queues

We will see stuff like1 FIFO Structure2 Operations: Queue, dequeue, etc3 Queue Implementation4 Applications

To implement, for example, schedulers

7 / 17

Page 23: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Queues

We will see stuff like1 FIFO Structure2 Operations: Queue, dequeue, etc3 Queue Implementation4 Applications

To implement, for example, schedulers

7 / 17

Page 24: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

QueuesWe will see stuff like

1 FIFO Structure2 Operations: Queue, dequeue, etc3 Queue Implementation4 Applications

To implement, for example, schedulers

Ready Queue

Partially Executed Swapped-Out Processes

CPU

I/O I/O Waiting Queues

Swap Out

7 / 17

Page 25: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Trees

We will see stuff like1 Operations: In-order, post-order, pre-order walks2 Binary Search3 Heaps4 Applications

To implement, for example, way of storing cell numbers

8 / 17

Page 26: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Trees

We will see stuff like1 Operations: In-order, post-order, pre-order walks2 Binary Search3 Heaps4 Applications

To implement, for example, way of storing cell numbers

8 / 17

Page 27: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Trees

We will see stuff like1 Operations: In-order, post-order, pre-order walks2 Binary Search3 Heaps4 Applications

To implement, for example, way of storing cell numbers

8 / 17

Page 28: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Trees

We will see stuff like1 Operations: In-order, post-order, pre-order walks2 Binary Search3 Heaps4 Applications

To implement, for example, way of storing cell numbers

8 / 17

Page 29: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Trees

We will see stuff like1 Operations: In-order, post-order, pre-order walks2 Binary Search3 Heaps4 Applications

To implement, for example, way of storing cell numbers2

7

2 6

5 11

5

9

4

8 / 17

Page 30: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Priority Queues

Here, we will see1 How to implement the priority queues.2 Which structure is good for it.

This can be used, for example, to implement Round Robin Schedulers

9 / 17

Page 31: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Priority QueuesHere, we will see

1 How to implement the priority queues.2 Which structure is good for it.

This can be used, for example, to implement Round Robin Schedulers

2

1

0

Shorter Quantum

Longer Quantum

Preempted

Preempted

Higher P

riority

9 / 17

Page 32: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dictionary Data Structures

We will see two main possible implementations1 Hash Tables2 AVL-Trees

They can be used to process great amounts of Data, Yes BIG DATAWe have the Bloom Filter (Circa 1970) which are being used in largeSQL databases to generate candidate query answers.Locality Sensitive Hashing to analyze similar documents.Graph applications using the Z-buffer and hash tables to sort meshpoints for fast renderization.

10 / 17

Page 33: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dictionary Data Structures

We will see two main possible implementations1 Hash Tables2 AVL-Trees

They can be used to process great amounts of Data, Yes BIG DATAWe have the Bloom Filter (Circa 1970) which are being used in largeSQL databases to generate candidate query answers.Locality Sensitive Hashing to analyze similar documents.Graph applications using the Z-buffer and hash tables to sort meshpoints for fast renderization.

10 / 17

Page 34: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dictionary Data Structures

We will see two main possible implementations1 Hash Tables2 AVL-Trees

They can be used to process great amounts of Data, Yes BIG DATAWe have the Bloom Filter (Circa 1970) which are being used in largeSQL databases to generate candidate query answers.Locality Sensitive Hashing to analyze similar documents.Graph applications using the Z-buffer and hash tables to sort meshpoints for fast renderization.

10 / 17

Page 35: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dictionary Data Structures

We will see two main possible implementations1 Hash Tables2 AVL-Trees

They can be used to process great amounts of Data, Yes BIG DATAWe have the Bloom Filter (Circa 1970) which are being used in largeSQL databases to generate candidate query answers.Locality Sensitive Hashing to analyze similar documents.Graph applications using the Z-buffer and hash tables to sort meshpoints for fast renderization.

10 / 17

Page 36: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dictionary Data Structures

We will see two main possible implementations1 Hash Tables2 AVL-Trees

They can be used to process great amounts of Data, Yes BIG DATAWe have the Bloom Filter (Circa 1970) which are being used in largeSQL databases to generate candidate query answers.Locality Sensitive Hashing to analyze similar documents.Graph applications using the Z-buffer and hash tables to sort meshpoints for fast renderization.

10 / 17

Page 37: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dictionary Data Structures

We will see two main possible implementations1 Hash Tables2 AVL-Trees

They can be used to process great amounts of Data, Yes BIG DATAWe have the Bloom Filter (Circa 1970) which are being used in largeSQL databases to generate candidate query answers.Locality Sensitive Hashing to analyze similar documents.Graph applications using the Z-buffer and hash tables to sort meshpoints for fast renderization.

10 / 17

Page 38: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Disjoint Set Representation

How to support Disjoint Sets by1 Circular Lists2 Forrest of Up-Trees3 Self-Adjusting Forest of Up-Trees4 Finally, Path Compression.

ApplicationsTo keep track of connected components in a undirected graph during.To help finding the minimum spanning tree in algorithms as theKruskal’s Algorithm.

11 / 17

Page 39: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Disjoint Set Representation

How to support Disjoint Sets by1 Circular Lists2 Forrest of Up-Trees3 Self-Adjusting Forest of Up-Trees4 Finally, Path Compression.

ApplicationsTo keep track of connected components in a undirected graph during.To help finding the minimum spanning tree in algorithms as theKruskal’s Algorithm.

11 / 17

Page 40: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Disjoint Set Representation

How to support Disjoint Sets by1 Circular Lists2 Forrest of Up-Trees3 Self-Adjusting Forest of Up-Trees4 Finally, Path Compression.

ApplicationsTo keep track of connected components in a undirected graph during.To help finding the minimum spanning tree in algorithms as theKruskal’s Algorithm.

11 / 17

Page 41: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Disjoint Set Representation

How to support Disjoint Sets by1 Circular Lists2 Forrest of Up-Trees3 Self-Adjusting Forest of Up-Trees4 Finally, Path Compression.

ApplicationsTo keep track of connected components in a undirected graph during.To help finding the minimum spanning tree in algorithms as theKruskal’s Algorithm.

11 / 17

Page 42: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Disjoint Set Representation

How to support Disjoint Sets by1 Circular Lists2 Forrest of Up-Trees3 Self-Adjusting Forest of Up-Trees4 Finally, Path Compression.

ApplicationsTo keep track of connected components in a undirected graph during.To help finding the minimum spanning tree in algorithms as theKruskal’s Algorithm.

11 / 17

Page 43: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Disjoint Set Representation

How to support Disjoint Sets by1 Circular Lists2 Forrest of Up-Trees3 Self-Adjusting Forest of Up-Trees4 Finally, Path Compression.

ApplicationsTo keep track of connected components in a undirected graph during.To help finding the minimum spanning tree in algorithms as theKruskal’s Algorithm.

11 / 17

Page 44: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Graphs

We will see1 Definition and Representations

1 Adjacency List and Matrix2 Breadth-First Search3 Depth-First Search

Applications: Finding a path in a Graph.

12 / 17

Page 45: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Graphs

We will see1 Definition and Representations

1 Adjacency List and Matrix2 Breadth-First Search3 Depth-First Search

Applications: Finding a path in a Graph.

12 / 17

Page 46: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Graphs

We will see1 Definition and Representations

1 Adjacency List and Matrix2 Breadth-First Search3 Depth-First Search

Applications: Finding a path in a Graph.

12 / 17

Page 47: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Graphs

We will see1 Definition and Representations

1 Adjacency List and Matrix2 Breadth-First Search3 Depth-First Search

Applications: Finding a path in a Graph.

12 / 17

Page 48: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

GraphsWe will see

1 Definition and Representations1 Adjacency List and Matrix

2 Breadth-First Search3 Depth-First Search

Applications: Finding a path in a Graph.

12 / 17

Page 49: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Divide and Conquer

We will seeThe Basic Method for Many Computer Scientists need to know as theconversion from recursive to iterative.

Applications: Quick Sort.

13 / 17

Page 50: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Divide and Conquer

We will seeThe Basic Method for Many Computer Scientists need to know as theconversion from recursive to iterative.

Applications: Quick Sort.

p i i+1 j-1

r

A[k]<x A[k]>x

13 / 17

Page 51: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Greedy Method

We will seeThe Method

1 The Optimal Substructure2 The Greedy Choice3 The Recursion Definition4 The Iterative Definition

Applications: 0/1 Knapsack.

14 / 17

Page 52: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Greedy Method

We will seeThe Method

1 The Optimal Substructure2 The Greedy Choice3 The Recursion Definition4 The Iterative Definition

Applications: 0/1 Knapsack.

14 / 17

Page 53: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Greedy Method

We will seeThe Method

1 The Optimal Substructure2 The Greedy Choice3 The Recursion Definition4 The Iterative Definition

Applications: 0/1 Knapsack.

14 / 17

Page 54: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Greedy Method

We will seeThe Method

1 The Optimal Substructure2 The Greedy Choice3 The Recursion Definition4 The Iterative Definition

Applications: 0/1 Knapsack.

14 / 17

Page 55: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Greedy MethodWe will seeThe Method

1 The Optimal Substructure2 The Greedy Choice3 The Recursion Definition4 The Iterative Definition

Applications: 0/1 Knapsack.

14 / 17

Page 56: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dynamic Programming

We will seeThe Method

1 The Optimal Substructure2 Making Decisions3 The Recursion Definition4 Use Extra Memory5 The Iterative Definition

Applications: Chain Matrix Multiplications for Cryptography

15 / 17

Page 57: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dynamic Programming

We will seeThe Method

1 The Optimal Substructure2 Making Decisions3 The Recursion Definition4 Use Extra Memory5 The Iterative Definition

Applications: Chain Matrix Multiplications for Cryptography

15 / 17

Page 58: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dynamic Programming

We will seeThe Method

1 The Optimal Substructure2 Making Decisions3 The Recursion Definition4 Use Extra Memory5 The Iterative Definition

Applications: Chain Matrix Multiplications for Cryptography

15 / 17

Page 59: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dynamic Programming

We will seeThe Method

1 The Optimal Substructure2 Making Decisions3 The Recursion Definition4 Use Extra Memory5 The Iterative Definition

Applications: Chain Matrix Multiplications for Cryptography

15 / 17

Page 60: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dynamic Programming

We will seeThe Method

1 The Optimal Substructure2 Making Decisions3 The Recursion Definition4 Use Extra Memory5 The Iterative Definition

Applications: Chain Matrix Multiplications for Cryptography

15 / 17

Page 61: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Dynamic ProgrammingWe will seeThe Method

1 The Optimal Substructure2 Making Decisions3 The Recursion Definition4 Use Extra Memory5 The Iterative Definition

Applications: Chain Matrix Multiplications for Cryptography

RECIPIENTSENDER

Plaintext

ENCRYPT

Ciphertext

ENCRYPT

Plaintext

Recipient's Public Key Recipient's Private Key

Different KeysFor Encryptand Decrypt

15 / 17

Page 62: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

Backtracking

We will seeThe Method

Backtracking is a general algorithm for finding solutions to somecomputational problem.It incrementally builds candidates to the solutions, and abandons eachpartial candidate c ("backtracks").

16 / 17

Page 63: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation

ExampleApplication: Display of Information in a Web Page when the size ofthe page changeshttp://www.brainyquote.com/quotes/keywords/will.html

17 / 17