130 likes | 148 Views
This lecture covers the fundamentals of algorithm efficiency, including a review of data structures, graphs, trees, elementary sets and dictionaries, and foundations of algorithmic analysis.
E N D
Intro to Computer Algorithms Lecture 2 Phillip G. Bradford Computer Science University of Alabama
Announcements • ACM initial meeting of the year. • Thursday, August 28th, 5:00pm • in East Eng. 119 • Industrial Colloquium Series • Tuesday, September 2nd, 5:00pm in EE 119 • Herschel Chandler presents: • “Being an Independent Computer Consultant”
Lecture Outline • Questions? • Add this HW to Thursday: • Page 23, #1 • Page 24, #4 & #5 • Data Structures Review • Fundamentals of Algorithm Efficiency • Chapter 2.
Brief Review of Data Structures • Lists • Linked Lists • Doubly-Linked Lists
Brief Review of Data Structures: Graphs • Graphs: G = (V,E) • Directed Graphs: digraphs • Loop issues • Edge Bound: |V|(|V| -1)/2 > |E| > 0 • Sparse • Dense • Adjacency Matrix • Adjacency List
Review of Graph Basics • Complete graphs • Kn • How many edges? • Examples at the board
Review of Graph Basics • Paths & Cycles • Acyclic graphs • Path lengths • Simple paths • Connected components • Subgraphs
Review of Tree Basics • Forests • Free Tree: acyclic graph with a unique path between every pair of distinct nodes • Rooted Trees: choose a root • Parents, siblings, ancestors, etc. • Leaves • Examples at the board
Elementary Sets and Dictionaries • What is a set? • How might we represent a set? • One way: bit vectors • The basis is the universal set • Dictionary • Inserting words • Deleting words • Looking up words
Foundations of Algorithmic Analysis • Time and Space • Other resources? • Time-Space trade-offs • Time-Complexity • Space-Complexity • Fundamental Operations • Can space complexity be larger than time complexity? • If so, when?
Foundations of Algorithmic Analysis • Input size measures • Number and structure of inputs • Size of inputs • Bit representation • Table 2.1 Page 46.
Worst Case, Average Case, etc. • Sequential Search • Best case • Worst case • Average Case • Prob[A[i] = K] = p
Asymptotic Notation • Big-O • Big-Omega • Big-Theta