Lecture Notes for stringlengths 1 100 | Unnamed: 1 nullclasses 7 values | Unnamed: 2 null | Unnamed: 3 null |
|---|---|---|---|
Data Structures and Algorithms | null | null | null |
Revised each year by John Bullinaria | null | null | null |
School of Computer Science | null | null | null |
University of Birmingham | null | null | null |
Birmingham, UK | null | null | null |
Version of 27 March 2019ThesenotesarecurrentlyrevisedeachyearbyJohnBullinaria. Theyincludesectionsba | null | null | null |
notes originally written by Mart´ın Escard´o and revised by Manfred Kerber. All are members | null | null | null |
of the School of Computer Science, University of Birmingham, UK. | null | null | null |
(cid:13)c School of Computer Science, University of Birmingham, UK, 2018 | null | null | null |
1Contents | null | null | null |
1 Introduction 5 | null | null | null |
1.1 Algorithms as opposed to programs . . . . . . . . . . . . . . . . . . . . . . . . . 5 | null | null | null |
1.2 Fundamental questions about algorithms . . . . . . . . . . . . . . . . . . . . . . 6 | null | null | null |
1.3 Data structures, abstract data types, design patterns . . . . . . . . . . . . . . . 7 | null | null | null |
1.4 Textbooks and web-resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 | null | null | null |
1.5 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 | null | null | null |
2 Arrays, Iteration, Invariants 9 | null | null | null |
2.1 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 | null | null | null |
2.2 Loops and Iteration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 | null | null | null |
2.3 Invariants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 | null | null | null |
3 Lists, Recursion, Stacks, Queues 12 | null | null | null |
3.1 Linked Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 | null | null | null |
3.2 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 | null | null | null |
3.3 Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 | null | null | null |
3.4 Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 | null | null | null |
3.5 Doubly Linked Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 | null | null | null |
3.6 Advantage of Abstract Data Types . . . . . . . . . . . . . . . . . . . . . . . . . 20 | null | null | null |
4 Searching 21 | null | null | null |
4.1 Requirements for searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 | null | null | null |
4.2 Specification of the search problem . . . . . . . . . . . . . . . . . . . . . . . . . 22 | null | null | null |
4.3 A simple algorithm: Linear Search . . . . . . . . . . . . . . . . . . . . . . . . . 22 | null | null | null |
4.4 A more efficient algorithm: Binary Search . . . . . . . . . . . . . . . . . . . . . 23 | null | null | null |
5 Efficiency and Complexity 25 | null | null | null |
5.1 Time versus space complexity . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 | null | null | null |
5.2 Worst versus average complexity . . . . . . . . . . . . . . . . . . . . . . . . . . 25 | null | null | null |
5.3 Concrete measures for performance . . . . . . . . . . . . . . . . . . . . . . . . . 26 | null | null | null |
5.4 Big-O notation for complexity class . . . . . . . . . . . . . . . . . . . . . . . . . 26 | null | null | null |
5.5 Formal definition of complexity classes . . . . . . . . . . . . . . . . . . . . . . . 29 | null | null | null |
6 Trees 31 | null | null | null |
6.1 General specification of trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 | null | null | null |
6.2 Quad-trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 | null | null | null |
6.3 Binary trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 | null | null | null |
26.4 Primitive operations on binary trees . . . . . . . . . . . . . . . . . . . . . . . . 34 | null | null | null |
6.5 The height of a binary tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 | null | null | null |
6.6 The size of a binary tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 | null | null | null |
6.7 Implementation of trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 | null | null | null |
6.8 Recursive algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 | null | null | null |
7 Binary Search Trees 40 | null | null | null |
7.1 Searching with arrays or lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 | null | null | null |
7.2 Search keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 | null | null | null |
7.3 Binary search trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 | null | null | null |
7.4 Building binary search trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 | null | null | null |
7.5 Searching a binary search tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 | null | null | null |
7.6 Time complexity of insertion and search . . . . . . . . . . . . . . . . . . . . . . 43 | null | null | null |
7.7 Deleting nodes from a binary search tree . . . . . . . . . . . . . . . . . . . . . . 44 | null | null | null |
7.8 Checking whether a binary tree is a binary search tree . . . . . . . . . . . . . . 46 | null | null | null |
7.9 Sorting using binary search trees . . . . . . . . . . . . . . . . . . . . . . . . . . 47 | null | null | null |
7.10 Balancing binary search trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 | null | null | null |
7.11 Self-balancing AVL trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 | null | null | null |
7.12 B-trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 | null | null | null |
8 Priority Queues and Heap Trees 51 | null | null | null |
8.1 Trees stored in arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 | null | null | null |
8.2 Priority queues and binary heap trees . . . . . . . . . . . . . . . . . . . . . . . 52 | null | null | null |
8.3 Basic operations on binary heap trees . . . . . . . . . . . . . . . . . . . . . . . 53 | null | null | null |
8.4 Inserting a new heap tree node . . . . . . . . . . . . . . . . . . . . . . . . . . . 54 | null | null | null |
8.5 Deleting a heap tree node . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 | null | null | null |
8.6 Building a new heap tree from scratch . . . . . . . . . . . . . . . . . . . . . . . 56 | null | null | null |
8.7 Merging binary heap trees . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 | null | null | null |
8.8 Binomial heaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 | null | null | null |
8.9 Fibonacci heaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 | null | null | null |
8.10 Comparison of heap time complexities . . . . . . . . . . . . . . . . . . . . . . . 62 | null | null | null |
9 Sorting 63 | null | null | null |
9.1 The problem of sorting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 | null | null | null |
9.2 Common sorting strategies. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 | null | null | null |
9.3 How many comparisons must it take? . . . . . . . . . . . . . . . . . . . . . . . 64 | null | null | null |
9.4 Bubble Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66 | null | null | null |
9.5 Insertion Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 | null | null | null |
9.6 Selection Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69 | null | null | null |
9.7 Comparison of O(n2) sorting algorithms . . . . . . . . . . . . . . . . . . . . . . 70 | null | null | null |
9.8 Sorting algorithm stability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 | null | null | null |
9.9 Treesort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71 | null | null | null |
9.10 Heapsort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72 | null | null | null |
9.11 Divide and conquer algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . 74 | null | null | null |
9.12 Quicksort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 | null | null | null |
9.13 Mergesort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 | null | null | null |
9.14 Summary of comparison-based sorting algorithms . . . . . . . . . . . . . . . . . 81 | null | null | null |
39.15 Non-comparison-based sorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81 | null | null | null |
9.16 Bin, Bucket, Radix Sorts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83 | null | null | null |
10 Hash Tables 85 | null | null | null |
10.1 Storing data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 | null | null | null |
10.2 The Table abstract data type . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85 | null | null | null |
10.3 Implementations of the table data structure . . . . . . . . . . . . . . . . . . . . 87 | null | null | null |
10.4 Hash Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 | null | null | null |
10.5 Collision likelihoods and load factors for hash tables . . . . . . . . . . . . . . . 88 | null | null | null |
10.6 A simple Hash Table in operation . . . . . . . . . . . . . . . . . . . . . . . . . . 89 | null | null | null |
10.7 Strategies for dealing with collisions . . . . . . . . . . . . . . . . . . . . . . . . 90 | null | null | null |
10.8 Linear Probing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 | null | null | null |
10.9 Double Hashing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 | null | null | null |
10.10Choosing good hash functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 | null | null | null |
10.11Complexity of hash tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 | null | null | null |
End of preview. Expand
in Data Studio
Dataset Card for Dataset Name
Dataset Summary
This dataset card aims to be a base template for new datasets. It has been generated using this raw template.
Supported Tasks and Leaderboards
[More Information Needed]
Languages
[More Information Needed]
Dataset Structure
Data Instances
[More Information Needed]
Data Fields
[More Information Needed]
Data Splits
[More Information Needed]
Dataset Creation
Curation Rationale
[More Information Needed]
Source Data
Initial Data Collection and Normalization
[More Information Needed]
Who are the source language producers?
[More Information Needed]
Annotations
Annotation process
[More Information Needed]
Who are the annotators?
[More Information Needed]
Personal and Sensitive Information
[More Information Needed]
Considerations for Using the Data
Social Impact of Dataset
[More Information Needed]
Discussion of Biases
[More Information Needed]
Other Known Limitations
[More Information Needed]
Additional Information
Dataset Curators
[More Information Needed]
Licensing Information
[More Information Needed]
Citation Information
[More Information Needed]
Contributions
[More Information Needed]
- Downloads last month
- 13