DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4...
Transcript of DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4...
![Page 1: DataStructures - CINVESTAV · Outline 1 Introduction 2 LinkedLists 3 MultidimensionalArrays 4 Stacks 5 Queues 6 Trees 7 PriorityQueues 8 DictionaryDataStructures 9 DisjointSetRepresentation](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/1.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/2.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/3.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/4.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/5.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/6.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/7.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/8.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/9.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/10.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/11.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/12.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/13.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/14.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/15.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/16.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/17.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/18.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/19.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/20.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/21.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/22.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/23.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/24.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/25.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/26.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/27.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/28.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/29.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/30.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/31.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/32.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/33.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/34.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/35.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/36.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/37.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/38.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/39.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/40.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/41.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/42.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/43.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/44.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/45.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/46.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/47.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/48.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/49.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/50.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/51.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/52.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/53.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/54.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/55.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/56.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/57.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/58.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/59.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/60.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/61.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/62.jpg)
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](https://reader034.fdocuments.net/reader034/viewer/2022042811/5fa1e4fbd06e501a2b13734a/html5/thumbnails/63.jpg)
ExampleApplication: Display of Information in a Web Page when the size ofthe page changeshttp://www.brainyquote.com/quotes/keywords/will.html
17 / 17