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

Post on 09-Aug-2020

3 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Data StructuresSyllabus

Andres Mendez-Vazquez

December 3, 2015

1 / 17

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

Introduction

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

3 / 17

Introduction

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

3 / 17

Introduction

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

3 / 17

Introduction

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

3 / 17

Introduction

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

3 / 17

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

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

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

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

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

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

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

Stacks

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

To solve problems like

6 / 17

Stacks

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

To solve problems like

6 / 17

Stacks

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

To solve problems like

6 / 17

Stacks

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

To solve problems like

6 / 17

StacksWe will see stuff like

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

To solve problems like

6 / 17

Queues

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

To implement, for example, schedulers

7 / 17

Queues

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

To implement, for example, schedulers

7 / 17

Queues

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

To implement, for example, schedulers

7 / 17

Queues

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

To implement, for example, schedulers

7 / 17

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Greedy MethodWe will seeThe Method

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

Applications: 0/1 Knapsack.

14 / 17

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

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

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

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

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

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

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

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

17 / 17

top related