Complete List of Terms and Definitions for cop
| Terms | Definitions |
|---|---|
| roots,stem,leaves | non-vascular plants lack the following: |
|
Bidirectional Iterator Interface |
Proper Type Forward Iterator Additional Operations Iterator& operator --(); Iterator operator --(int); |
| cuticle | waxy layer on stems and leaves |
| carrot rose bushes trees | vascular do include |
| TVector Operation Runtime Complexity | Requirement Actual PopBack(), Clear()Front(), Back()Empty(), Size(), Capacity()bracket operator [] O(1) T(1) PushBack(t) Amortized O(1) Amortized T(1) SetSize(n), SetCapacity(n) O(n) O(n) assignment operator = O(n), n = Capacity() T(n), n = Capacity() Constructors, DestructorO(n), n = Capacity() T(n), n = Capacity() Display(os,ofc) T(n), n = Size() Dump(os) T(n), n = Capacity() |
| TBinaryTreeInorderIterator |
template < typename T > void TBinaryTreeInorderIterator<T>::Initialize (const TBinaryTree<T>& b) { // enter tree at root nav_ = b.Root(); // slide to leftmost node while (nav_.HasLeftChild()) ++nav_; } |
| dicot | flowering plant with two cotyledons in thier seeds |
| vascular | plants with tube like system of vessels |
| List Interface | The interface for fsu::TList conforms to the constraints for sequential containers. The operations that distinguish TList among all sContainers are highlighted in color. |
| Priority Queue |
Element type with priority typename T t predicate class P p Associative queue operations void Push(t) void Pop() T& Front() Associative property Priority value determined by p Push(t) inserts t (no position implied), increases size by 1 Pop() removes element with highest priority value, decreases size by 1 Front() returns element with highest priority value, no state change |
| The following comparison sort is stable and has the best possible worst case runtime: |
Merge Sort |
| rhizoids | moss plants are held by threads made up of a few long cells called _______________ |
| seedless vascular | ferns are most abundant of the ____________________ plants |
| Key Comparisons Sort |
Theorem. Any comparison sort requires Ω(n log n) comparisons in the worst case. Proof. Use decision tree for the algorithm Binary tree with node for each comparison, leaf for each solution Each leaf represents a permutation of the input range Sort of a particular data set is represented by a descending path to a leaf Length of this path = number of comparisons made by the sort n! leaves Depth >= log2n! log2n! >= Ω(n log n) by Stirlings formula |
| Deque Implementation Plan |
Our implementation for TDeque uses another item from classical data structures tradition: the circular array. (The STL version of deque uses a different implementation.) The essential ingredients are depicted in the slide. Here is the actual declaration of protected data from the TDeque class definition: protected: T* content; unsigned int content_size, beg, end; Consistency between content and content_size must be maintained at all times: content_size is the size of memory allocated to the array content. |
| Correctness and Loop Invariants |
Loops Loop termination State entering loop State exiting loop Loop invariants Statements that are true in each iteration of loop Analogous to the "induction" part of mathematical induction |
| The run space requirement of Bit Sort (n = size of input) is | +Θ(n) |
|
FSU sContainers TVector, TList, TDeque What do they all have in common? |
All: Proper Type Front(), Back() PushBack(t), PopBack() Clear() Empty(), Size() Bidirectional Iterators Begin(), End(), rBegin(), rEnd() |
| Generic Heap Algorithms |
Apply to ranges Omit size change (step 1) Specified by random access iterators Currently support: arrays TVector<T> TDeque<T> Source code file: gheap.h Test code file: fgss.cpp |
| Binary Search |
Algorithm for finding a value in a collection of values Collection must have "array-like" structure random access to data through bracket operator example containers: array, vector, deque Collection must be sorted elements in increasing (or decreasing) order Idea: "Divide and Conquer" Efficiency: very fast no extra space required |
| COMPARISON SORT IS STABLE AND HAS BEST POSSIBLE WCRT? | MERGE SORT |
| pioneer species | name given to the first plants to grow in new enviroment |
| Vector Implementation Plan | The plan shows that we are just putting a nice "face" on a C-array, managing memory for the client program. The client can manage the footprint in as much detail as desired via the "allocator" methods SetSize and SetCapacity. Note that SetSize is expansive only, whereas SetCapacity sets the footprint size precisely, whether increasing or decreasing from the current capacity. |
|
Define an edge move to be a call to any of the following fsu::TBinaryTree::Navigator operations: Initialize() (i.e., assignment to root), ++(), ++(int), --(), or --(int). What, for a general binary tree, should the sum of all edge moves in an inorde |
2n |
| Trace a traversal of a binary tree [4 kinds] | Traversal Type Container Visit VertexInorder DFS Preorder DFS Stack ArrivalPostorder DFS Stack DepartureLevelorder BFS Queue Departure |
|
A comparison sort is: |
A sort in which decisions are made based on key comparisons. |
| what does size mean | When "size" is used it always means a count of the number of items in input - it does not mean "sizeof" any type. |
| absorbs water, anchor plant and store food | roots usaully have all of the following functions |
| Code implementing merge_sort (A, p, r) for the index range [p,r)in the array is: | void merge_sort(int* A, size_t p, size_t r){ if (r - p > 1) { q = (p+r)/2; merge_sort(A,p,q); merge_sort(A,q,r); merge(A,p,q,r); // defined in separate function using g_set_merge }} |
| Algorithm Complexity - Loops Nested |
for (i = 0; i < n; ++i) { // 2 atomics in outer loop body for (j = 0; j < n; ++j) { // 3 atomics in inner loop body } } Complexity <= O((2 + 3n)n) <= O(2n + 3n2) <= O(n2) Complexity = Θ((2 + 3n)n) = Θ(2n + 3n2) = Θ(n2) |
| Given the array a = [ F , G , A , H , B , D ] show the result of the first call to Partition in Quick Sort with the pivot value chosen to be the last element of the array. |
[ A , B , D , H , G , F ] |