**Algorithms: 24-part Lecture Series**

English | MP4 | AVC 1280×720 | AAC 44KHz 2ch | 28h 18m | 10.0 GB

These Algorithms Video Lectures cover the essential information that every serious programmer needs to know about algorithms and data structures, with emphasis on applications and scientific performance analysis of Java implementations.

This collection of video lectures provides a comprehensive exploration of fundamental data types, algorithms, and data structures, with an emphasis on applications and scientific performance analysis of Java implementations. The instructors offer readings related to these lectures that you can find in Algorithms, Fourth Edition, the leading textbook on algorithms today. These lectures provide another perspective on the material presented in the book and generally cover the material in the same order, though some book topics have been combined, rearranged, or omitted in the lectures.

What You Will Learn

These videos survey the most important computer algorithms in use today. The algorithms described in these lectures represent a body of knowledge developed of the last 50 years that has become indispensable. These lectures present:

- Implementations of useful algorithms
- Detailed information on performance characteristics
- Examples of clients and applications

The early lectures cover our fundamental approach to studying algorithms, including data types for stacks, queues, and other low-level abstractions. Then we cover these major topics:

- Sorting algorithms, highlighting the classic Quicksort and Mergesort algorithms.
- Searching algorithms, including search methods based on balanced search trees and hashing.
- String-processing algorithms, from tries and substring search to regular expression search and data compression.
- Graph algorithms, starting with graph search, shortest paths, and minimum spanning trees, and working up to maximum flow/minimum cut and applications.
- Reductions, linear programming, and intractability.

Who Should Take This Course

The study of algorithms and data structures is fundamental to any computer-science curriculum, but it is not just for programmers and computer science students. These lectures are intended for:

- Any student (from high school to graduate level) having a good introduction to programming, with an interest in majoring in any science or engineering discipline (including computer science).
- Anyone using a computer to address large problems that require an understanding of efficient algorithms.
- Anyone interested in preparing for a career in industry involving software or computer applications.

Lecture 1: Union-Find. We illustrate our basic approach to developing and analyzing algorithms by considering the dynamic connectivity problem. We introduce the union-find data type and consider several implementations (quick find, quick union, weighted quick union, and weighted quick union with path compression). Finally, we apply the union-find data type to the percolation problem from physical chemistry.

Lecture 2: Analysis of Algorithms. The basis of our approach for analyzing the performance of algorithms is the scientific method. We begin by performing computational experiments to measure the running times of our programs. We use these measurements to develop hypotheses about performance. Next, we create mathematical models to explain their behavior. Finally, we consider analyzing the memory usage of our Java programs.

Lecture 3: Stacks and Queues. We consider two fundamental data types for storing collections of objects: the stack and the queue. We implement each using either a singly-linked list or a resizing array. We introduce two advanced Java features generics and iterators that simplify client code. Finally, we consider various applications of stacks and queues ranging from parsing arithmetic expressions to simulating queueing systems.

Lecture 4: Elementary Sorts. We introduce the sorting problem and Java’s Comparable interface. We study two elementary sorting methods (selection sort andinsertion sort) and a variation of one of them (shellsort). We also consider two algorithms for uniformly shuffling an array. We conclude with an application of sorting to computing the convex hull via the Graham scan algorithm.

Lecture 5: Mergesort. We study the mergesort algorithm and show that it guarantees to sort any array of N items with at most NlgN compares. We also consider a nonrecursive, bottom-up version. We prove that any compare-based sorting algorithm must make at least NlgN compares in the worst case. We discuss using different orderings for the objects that we are sorting and the related concept of stability.

Lecture 6: Quicksort. We introduce and implement the randomized quicksort algorithm and analyze its performance. We also consider randomized quickselect, a quicksort variant which finds the kth smallest item in linear time. Finally, consider 3-way quicksort, a variant of quicksort that works especially well in the presence of duplicate keys.

Lecture 7: Priority Queues. We introduce the priority queue data type and an efficient implementation using the binary heap data structure. This implementation also leads to an efficient sorting algorithm known as heapsort. We conclude with an applications of priority queues where we simulate the motion of N particles subject to the laws of elastic collision.

Lecture 8: Elementary Symbol Tables. We define an API for symbol tables (also known as associative arrays) and describe two elementary implementations using a sorted array (binary search) and an unordered list (sequential search). When the keys are Comparable, we define an extended API that includes the additional methods min, max floor, ceiling, rank, and select. To develop an efficient implementation of this API, we study the binary search tree data structure and analyze its performance

Lecture 9: Balanced Search Trees. In this lecture, our goal is to develop a symbol table with guaranteed logarithmic performance for search and insert (and many other operations). We begin with 2-3 trees, which are easy to analyze but hard to implement. Next, we consider red-black binary search trees, which we view as a novel way to implement 2-3 trees as binary search trees. Finally, we introduce B-trees, a generalization of 2-3 trees that are widely used to implement file systems.

Lecture 10: Geometric Applications of BSTs. We start with 1d and 2d range searching, where the goal is to find all points in a given 1d or 2d interval. To accomplish this, we consider kd-trees, a natural generalization of BSTs when the keys are points in the plane (or higher dimensions). We also consider intersection problems, where the goal is to find all intersections among a set of line segments or rectangles.

Lecture 11: Hash Tables. We begin by describing the desirable properties of hash functions and how to implement them in Java, including a fundamental tenet known as the uniform hashing assumption that underlies the potential success of a hashing application. Then, we consider two strategies for implementing hash tables separate chaining and linear probing. Both strategies yield constant-time performance for search and insert under the uniform hashing assumption. We conclude with applications of symbol tables including sets, dictionary clients, indexing clients, and sparse vectors.

Lecture 12: Undirected Graphs. We define an undirected graph API and consider the adjacency-matrix and adjacency-lists representations. We introduce two classic algorithms for searching a graph depth-first search and breadth-first search. We also consider the problem of computing connected components and conclude with related problems and applications.

Lecture 13: Directed Graphs. In this lecture we study directed graphs. We begin with depth-first search and breadth-first search in digraphs and describe applications ranging from garbage collection to web crawling. Next, we introduce a depth-first search based algorithm for computing the topological order of an acyclic digraph. Finally, we implement the Kosaraju-Sharir algorithm for computing the strong components of a digraph.

Lecture 14: Minimum Spanning Trees. In this lecture we study the minimum spanning tree problem. We begin by considering a generic greedy algorithm for the problem. Next, we consider and implement two classic algorithms for the problem Kruskal’s algorithm and Prim’s algorithm. We conclude with some applications and open problems.

Lecture 15: Shortest Paths. In this lecture we study shortest-paths problems. We begin by analyzing some basic properties of shortest paths and a generic algorithm for the problem. We introduce and analyze Dijkstra’s algorithm for shortest-paths problems with nonnegative weights. Next, we consider an even faster algorithm for DAGs, which works even if the weights are negative. We conclude with the Bellman-Ford-Moore algorithm for edge-weighted digraphs with no negative cycles. We also consider applications ranging from content-aware fill to arbitrage.

Lecture 16: Maximum Flow and Minimum Cut. In this lecture we introduce the maximum flow and minimum cut problems. We begin with the Ford-Fulkerson algorithm. To analyze its correctness, we establish the maxflow-mincut theorem. Next, we consider an efficient implementation of the Ford-Fulkerson algorithm, using the shortest augmenting path rule. Finally, we consider applications, including bipartite matching and baseball elimination.

Lecture 17: Radix Sorts. In this lecture we consider specialized sorting algorithms for strings and related objects. We begin with a subroutine to sort integers in a small range. We then consider two classic radix sorting algorithms LSD and MSD radix sorts. Next, we consider an especially efficient variant, which is a hybrid of MSD radix sort and quicksort known as 3-way radix quicksort. We conclude with suffix sorting and related applications.

Lecture 18: Tries. In this lecture we consider specialized algorithms for symbol tables with string keys. Our goal is a data structure that is as fast as hashing and even more flexible than binary search trees. We begin with multiway tries; next we consider ternary search tries. Finally, we consider character-based operations, including prefix match and longest prefix, and related applications.

Lecture 19: Substring Search. In this lecture we consider algorithms for searching for a substring in a piece of text. We begin with a brute-force algorithm, whose running time is quadratic in the worst case. Next, we consider the ingenious Knuth-Morris-Pratt algorithm whose running time is guaranteed to be linear in the worst case. Then, we introduce the Boyer-Moore algorithm, whose running time is sublinear on typical inputs. Finally, we consider the Rabin-Karp fingerprint algorithm, which uses hashing in a clever way to solve the substring search and related problems.

Lecture 20: Regular Expressions. A regular expression is a method for specifying a set of strings. Our topic for this lecture is the famous grep algorithm that determines whether a given text contains any substring from the set. We examine an efficient implementation that makes use of our digraph reachability implementation from Lectures 1 and 2.

Lecture 21: Data Compression. We study and implement several classic data compression schemes, including run-length coding, Huffman compression, and LZW compression. We develop efficient implementations from first principles using a Java library for manipulating binary data that we developed for this purpose, based on priority queue and symbol table implementations from earlier lectures.

Lecture 22: Reductions. In this lecture our goal is to develop ways to classify problems according to their computational requirements. We introduce the concept of reduction as a technique for studying the relationship among problems. People use reductions to design algorithms, establish lower bounds, and classify problems in terms of their computational requirements.

Lecture 23: Linear Programming. The quintessential problem-solving model is known as linear programming, and the simplex method for solving it is one of the most widely used algorithms. In this lecture, we give an overview of this central topic in operations research and describe its relationship to algorithms that we have considered.

Lecture 24: Intractability. Is there a universal problem-solving model to which all problems that we would like to solve reduce and for which we know an efficient algorithm? You may be surprised to learn that we do not know the answer to this question. In this lecture we introduce the complexity classes P, NP, and NP-complete; pose the famous P = NP question; and consider implications in the context of algorithms that we have treated in this course.

**Table of Contents**

1 Algorithms – Introduction

2 Dynamic Connectivity

3 Quick Find

4 Quick Union

5 Quick-Union Improvements

6 Union-Find Applications

7 Introduction to Analysis of Algorithms

8 Observations

9 Mathematical Models

10 Order-of-Growth Classifications

11 Theory of Algorithms

12 Memory

13 Stacks

14 Resizing Arrays

15 Queues

16 Generics

17 Iterators

18 Stack and Queue Applications

19 Introduction to Sorting

20 Selection Sort

21 Insertion Sort

22 Shellsort

23 Shuffling

24 Convex Hull

25 Mergesort

26 Bottom-up Mergesort

27 Sorting Complexity

28 Comparators

29 Stability

30 Quicksort

31 Selection

32 Duplicate Keys

33 System Sorts

34 APIs and Elementary Implementations

35 Binary Heaps

36 Heapsort

37 Event-Driven Simulation

38 Symbol Table APIs

39 Elementary Implementations

40 Ordered Operations

41 Binary Search Trees

42 Ordered Operations in BSTs

43 Deletion in BSTs

44 Search Trees

45 Red-Black BSTs

46 B-Trees

47 Range Search

48 Line Segment Intersection

49 Kd-Trees

50 Interval Search Trees

51 Rectangle Intersection

52 Hash Functions

53 Separate Chaining

54 Linear Probing

55 Context

56 Sets

57 Dictionary Clients

58 Indexing Clients

59 Sparse Vectors

60 Introduction to Graphs

61 Graph API

62 Depth-First Search

63 Breadth-First Search

64 Connected Components

65 Graph Challenges

66 Introduction to Digraphs

67 Digraph API

68 Digraph Search

69 Topological Sort

70 Strong Components

71 Introduction to MSTs

72 Greedy Algorithm

73 Edge-Weighted Graph API

74 Kruskal’s Algorithm

75 Prim’s Algorithm

76 MST Context

77 Shortest Paths APIs

78 Shortest Path Properties

79 Dijkstra’s Algorithm

80 Edge-Weighted DAGs

81 Negative Weights

82 Introduction to Maxflow

83 Ford-Fulkerson Algorithm

84 Maxflow-Mincut Theorem

85 Running Time Analysis

86 Java Implementation

87 Maxflow Applications

88 Strings in Java

89 Key-Indexed Counting

90 LSD Radix Sort

91 MSD Radix Sort

92 3-way Radix Quicksort

93 Suffix Arrays

94 R-way Tries

95 Ternary Search Tries

96 Character-Based Operations

97 Introduction to Substring Search

98 Brute-Force Substring Search

99 Knuth-Morris-Pratt

100 Boyer-Moore

101 Rabin-Karp

102 Regular Expressions

103 REs and NFAs

104 NFA Simulation

105 NFA Construction

106 Regular Expression Applications

107 Introduction to Data Compression

108 Run-Length Coding

109 Huffman Compression

110 LZW Compression

111 Introduction to Reductions

112 Designing Algorithms

113 Establishing Lower Bounds

114 Classifying Problems

115 Brewer’s Problem

116 Simplex Algorithm

117 Simplex Implementations

118 Linear Programming Reductions

119 Introduction to Intractability

120 Search Problems

121 P vs. NP

122 Classifying Problems

123 NP-Completeness

124 Coping with Intractability

Resolve the captcha to access the links!