Final exam what we’ve learned Epilogue 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 1 - Monday Dec 10 8:00am—11:00am Cooke … FINAL EXAM 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 2 Format • Open book, open note, no electronic devices • Comprehensive • Same format as midterms, just longer 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 3 Coverage • Some basic C++ – Compilation – Arrays, pointers, definitions, declarations • Data structures – Stacks, queues, vectors – Lists – Trees, hash tables • Analysis – Asymptotic analysis, amortized analysis – Recurrence 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 4 - A data structure is a structure allowing for storing, searching, updating data efficiently - Efficiency is measured in terms of space and time WHAT WE HAVE LEARNED 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 5 Data structures • Arrays • Vectors • Linked Lists – Singly, Doubly, Skip, XOR • Stacks, Queues • Trees – BT, BST, AVL, Red-Black, Splay, (2,4)-, • Hash tables – Lazy array, direct access, hash codes, compression functions – Collision resolution: separate chaining, open addressing, cuckoo hashing 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 6 Algorithms Operating on Data Structures • Sorting on arrays & vectors • Traversing, updating, searching, computing on – Arrays/Vectors – Linked lists – Binary Trees – Hash tables 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 7 Analyze Data Structures • Asymptotic analysis • Amortized analysis 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 8 Some Key Lessons • Randomization is extremely powerful! – – – – – Quick sort Random BST Universal hash functions Splay trees Keep data structure simple yet efficient • Programming is not cut-and-pasting – Non-trivial even when we know the algorithm – The best part is to come up with an algorithm ourselves – Take CSE331, 431, 531 – need to analyze algorithms too … 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 9 Some Key Lessons • Designing a Data Structure involves – Mathematical analysis – Experiments – Implementation (in C++ or other languages) • In almost all cases, the “right” data structure for our problem depends on the problem domain – – – – Online dictionary High frequency trading Relational databases Domain Name System, BitTorrent, … 5/28/2016 CSE 250, Fall 2012, SUNY Buffalo, @Hung Q. Ngo 10