CS 314: Data Structures: Lecture Notes


Copyright © 2014 by Gordon S. Novak Jr.

Permission is granted for individuals to make copies of these notes for personal use, or for instructors to make copies for classroom use.

Note: Some of these pages use math symbols. Microsoft Internet Explorer will not display the math symbols, but Firefox will.

Index

1. CS 314: Data Structures
2. Course Topics
3. Introduction
4. eine kleine LispMusik
5. Fibonacci Numbers
6. Fibonacci Functions
7. Testing Fibonacci
8. Rates of Growth
9. Exponential Growth
10. Goals of the Course
11. Big O and Performance
12. Big O
13. Big O: An Upper Bound
14. Rules for Big O
15. Classes of Algorithms
16. Log n Grows Slowly
17. Log n Is Almost the Same as 1
18. Powers of 10: SI Prefixes
19. A Scientist Should Be Careful, Skeptical
20. Finding Big O: Log-log Graph
21. Log-log Example
22. Finding Big O: Semi-Log Graph
23. Big O from Timing Ratio
24. Computation Model
25. Big O from Code
26. Big O of Loops
27. Beware the Bermuda Triangle
28. Big O for Arrays
29. Average Case vs. Worst Case
30. Familiarity with Big O
31. Pointer / Reference
32. Boxed Number
33. References and {\tt ==}
34. {\tt ==} vs. {\tt .equals()}
35. Linked List
36. Constructing a Linked List
37. Access to Parts of a List
38. List Access Functions
39. Iterative Processing of List
40. Iterative List Design Pattern
41. Recursion
42. Designing Recursive Functions
43. Design Pattern for Recursive Functions
44. Recursive Processing of List
45. Recursive List Design Pattern
46. Tail Recursive Processing of List
47. Tail Recursive List Design Pattern
48. Constructive Linked List: Reverse
49. Tail Recursive Reverse
50. Tail Recursive Reverse in Java
51. Copying a List
52. Append
53. Iterative Append
54. Destructive Linked List Functions
55. Nconc
56. Nreverse
57. Set as Linked List
58. Intersection
59. Tail-Recursive Intersection
60. Tail-Recursive Intersection in Java
61. Union and Set Difference
62. Circularly Linked List
63. Merge
64. Constructive Merge
65. Tail Recursive Merge
66. Tail Recursive Merge in Java
67. Destructive Merge Function
68. Iterative Destructive Merge
69. Java Iterative Destructive Merge
70. Comparison in Java
71. Comparator in Java
72. Complex Comparator
73. Divide and Conquer
74. Dividing a List
75. Sorting by Merge
76. Tracing Sort and Merge
77. On Not Dropping the Ball
78. Divide and Conquer Design Pattern
79. Intersection by Merge
80. Merge Technique
81. Sort, then Merge
82. Association List
83. Stack using Linked List
84. Sentinel Node
85. Other Uses of Linked Lists
86. Arrays
87. Stack using Array
88. Uses of Stacks
89. Recursion and Runtime Stack
90. Recursive Function Execution
91. Recursive Execution ...
92. Recursive Length Function Execution
93. Balancing Parentheses
94. Balance Test Using Stack
95. Linked List Stack
96. Tree Traversal and Stack
97. XML
98. Stack in Plain Code
99. Queues
100. Two Pointer Queue using Linked List
101. Circular Queue using Array
102. Circular Queue Code
103. Java Collection API
104. Java Collections Iteration
105. Filter Pattern
106. Using Library Packages
107. Java List Interface
108. ArrayList
109. LinkedList
110. ListIterator
111. Comparing ArrayList and LinkedList
112. Trees
113. Arithmetic Expressions as Trees
114. Computer Programs as Trees
115. English Sentences as Trees
116. File Systems as Trees
117. Phylogenetic Trees
118. Taxonomies as Trees
119. Ontologies as Trees
120. Organizations as Trees
121. Nerves
122. Representations of Trees
123. Binary Tree
124. First-Child / Next-Sibling Tree
125. First-Child / Next-Sibling Example
126. Linked List Tree
127. Implicit Tree
128. Binary Search Tree (BST)
129. Binary Tree Search
130. Binary Search of Array
131. Binary Tree Array Search
132. Binary Array Search Example
133. Binary Tree Recursion
134. Binary Tree Recursion
135. Design Pattern: Binary Tree Recursion
136. Binary Tree Recursion Pattern in Java
137. Design Pattern: Binary Tree Recursion
138. Searching Directories for a File
139. Findpath Example
140. Findpath Representation
141. Java Version of Findpath
142. Lisp Version of Findpath
143. Searching Directories Example
144. Searching Directories Example ...
145. Big O for Trees
146. Depth First Search
147. Depth First Search Order
148. Robot Mouse in Maze
149. Robot Mouse in Java
150. Robot Mouse Program
151. Robot Mouse Example
152. Tracing the Robot Mouse
153. Tracing the Robot Mouse ...
154. Tree Traversal
155. Preorder
156. Preorder Example
157. Preorder Example in Java
158. Inorder
159. Inorder Printing of Binary Tree
160. Flattening Binary Tree
161. Tracing Flattening Binary Tree
162. Flattening Binary Tree in Java
163. Postorder
164. Balanced Binary Trees
165. AVL Tree
166. Tree Rotation
167. B-Tree
168. B-Tree Implementation
169. Advantages of B-Trees
170. Quadtree
171. Image Quadtree
172. Intersection of Quadtrees
173. Aggregate Data in Quadtrees
174. Uses of Quadtrees
175. Be Extreme!
176. Sparse Arrays
177. Pattern Matching Overview
178. Copy Tree and Substitute
179. Copy Tree and Substitute in Java
180. Binding Lists
181. Multiple Substitutions
182. Sublis in Java
183. Instantiating Design Patterns
184. Tree Equality
185. Tree Equality in Java
186. Tracing Equal
187. Design Pattern: Nested Tree Recursion
188. Tracing Nested Tree Recursion
189. Pattern Matching
190. Specifications of Match
191. Match Function
192. Match Function in Java
193. Transformation by Patterns
194. Transformation Patterns
195. Program Transformation using Lisp
196. Programs and Trees
197. Set API in Java
198. Map API in Java
199. Iteration over a {\tt Map}
200. Array as a {\tt Map}
201. Avoid Repeated Code
202. Initializing Array
203. Key of a {\tt Map}
204. Hashing
205. Hash Function
206. Java {\tt .hashCode()}
207. Exclusive OR
208. Uses of Exclusive OR
209. Hash Function for Strings
210. Hash Function for Application Types
211. Collisions
212. Hashing with Buckets
213. Hashing with Buckets: Code
214. Rehashing
215. Hash Tables in Java
216. Extendible Hashing
217. Uses of Hashing
218. Randomization
219. Priority Queue
220. Priority Queue with Array or Binary Tree
221. Binary Heap
222. Mapping to Array
223. Insertion into Heap
224. Removal from Heap
225. Uses of Priority Queues
226. {\tt PriorityQueue} in Java
227. Example Discrete Event Simulation
228. Sorting
229. Insertion Sort
230. Insertion Sort Performance
231. Heapsort
232. Merge Sort
233. Merge Sort Performance
234. Memory Hierarchy and Locality
235. Does Array Index Order Matter?
236. Array Storage and Indexing
237. Quicksort
238. Quicksort Code
239. Partitioning
240. Quicksort Example
241. Quicksort Performance
242. Radix Sort
243. Radix Sort Example
244. Sorting in Java Library
245. Graphs
246. Examples of Graphs
247. Directed Acyclic Graph
248. Graph Representations
249. Adjacency List
250. Adjacency Matrix
251. Implicit Graphs
252. Topological Sort
253. Uses of Topological Sort
254. PERT Chart
255. PERT Chart: Calculating Times
256. Shortest Path Problem
257. Dijkstra's Algorithm
258. Dijkstra's Algorithm
259. Dijkstra's Algorithm Example
260. Minimum Spanning Tree
261. Prim's Algorithm
262. Prim's Algorithm
263. Prim's Algorithm Example
264. Directed Search
265. Hill Climbing
266. Heuristic Search: A*
267. A* Algorithm
268. Ordered Search for Route Finding
269. Effect of Heuristic Function
270. Heuristic Search Handles Local Maxima
271. A* Algorithm Example
272. Graph Search Algorithm Summary
273. Mapping
274. Implementation of Mapping
275. Functional Programming
276. Associative and Commutative
277. Computation as Simulation
278. Mapping in Lisp
279. Mapcan
280. Input Filtering and Mapping
281. Reduce in Lisp
282. Combining Map and Reduce
283. MapReduce and Massive Data
284. Distributed Programming is Hard!
285. What MapReduce Does for Us
286. Map Sort Reduce
287. Simplified MapReduce
288. Mapreduce in Lisp
289. Simple MapReduce Example
290. MapReduce Example
291. Hamburger Example
292. PageRank
293. PageRank Example
294. Running PageRank Example
295. Advanced Performance
296. Performance Techniques in MapReduce
297. Buffering
298. Load Balancing
299. Algorithm Failure
300. Atomic Commit


CS 314