COM SCI 32 Study Guide - Final Guide: Binary Search Tree, Hash Table, Bubble Sort

122 views7 pages

Document Summary

Recursion, rules stopping condition simplifying step, generic programming, custom comparison operator, stl. Vector: declaration vector nums; or vector numofnums(10), add item nums. push_back(5), access element nums[2] = 3, front nums. front(), back nums. back(), delete, back nums. pop_back(), size, empty nums. empty(), size nums. size(); List list words; push_back, pop_back, front, back, size, empty. Iterator: declare vector::iterator it, access, set to first it = nums. begin(), cout << *it, it++, it-- (basically all pointer things you can do, last element it = nums. end() [points just past last element] it--; *it: const, vector::const_iterator it, all disappear after you add/erase item in vector. If delete item iterator points to, iterator invalid. Map create associations each left can only be associated with one right: declare map name2age, already pre-sorted, need a < operator for left parameter (e. g. string) Insert: name2age[ gar ] = 18, find it = name2age. find( gar ); (have if statement about if it equals end) uses a bst (binary search tree, unordered uses hash table.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers