CS 221

Programming in C++ - Data Structures


Review for the Final Exam


In an attempt to give you some guidance as you study for the final exam I have prepared the following review. It is, in fact, more than just a review for the final exam, but a list of all knowledge and concepts you need to take with you from this course into your future courses and career. Good luck!




  1. General Knowledge
    This information is part of the knowledge base you should have for all areas of Computer Science.
    1. What are the five steps in software development?
    2. What are the four types of software testing that should be performed?
    3. What are the eight most common "Big O" algorithm measures?
  2. Software Documentation
    What are each of the following documents and what role do they play in the process of software development?
    1. Statement of Work (SOW)
    2. Requirements Description Document (RDD)
    3. Software Requirements Specification (SRS)
    4. Software Design Document (SDD) or Software Development Plan (SDP)
    5. Software Test Plan (STP)
  3. Terms
    You should know the meanings of all the terms in this list.
    1. General
      • Abstract Data Type
      • Acceptance testing
      • Algorithm
      • Analysis of Algorithms
      • Best-fit memory allocation
      • Binary search
      • Bottom-up Program Design
      • Call by Reference
      • Call by Value
      • Data Abstraction
      • Driver function for software testing
      • Dynamic memory allocation
      • Encapsulation
      • First-fit memory allocation
      • Fragmentation, when referring to the heap
      • Greedy algorithm
      • Heap, when referring to memory
      • Information hiding
      • Integration testing
      • Object oriented programming (OOP)
      • Procedural programming
      • Recursion
      • Regression testing
      • Sequential search
      • Software Validation
      • Software Verification
      • Static memory allocation
      • Stepwise Refinement
      • Stub function for software testing
      • Top-down Program Design
      • Unit testing
    2. Trees
      • 2-3 tree
      • AVL tree
      • B-tree
      • Binary tree and Binary Search tree
      • Child node
      • Complete binary tree
      • Heap, when referring to trees.
      • Internal node
      • Leaf node
      • Parent node
      • Root
      • Sub-tree or branches
      • Trie
    3. Graphs
      • Adjacent vertices
      • Adjacency matrix
      • Adjacenty set
      • Connected components
      • Connected vertices
      • Cycle
      • Degree of a vertex
      • Directed graph
      • Edges
      • Minimal Spanning Tree of a graph
      • Path
      • Predecessors of a vertex
      • Shortest path in a graph
      • Simple cycle
      • Successors of a vertix
      • Vertices
      • Weighted graph
    4. Sets
      • Component (base) type
      • Subset
      • Universal Set
      • Empty Set
      • Cardinality
      • Intersection of two sets
      • Difference of two sets
      • Symmetrical Difference of two sets
      • Union of two sets
    5. Hashing
      • Cluster
      • Collision
      • Double hash function
      • Hash table
      • Hash function
      • Hashing with buckets
      • Hashing with chaining
      • Linear probing
      • Load factor
      • Open addressing
      • Perfect hash function
    6. C++
      • Class
      • Constructor function
      • Destructor function
      • Function Overloading
      • Implementation file
      • Instantiation
      • Object oriented programming
      • Polymorphism
      • private, when referring to variables and functions
      • protected, when referring to variables and functions
      • public, when referring to variables and functions
      • Templates (Function and Class)
  4. Pointers
    You should know what a pointer is and how to declare and use pointers in each of the following:
    1. Declare pointers to the 6 basic C data types.
    2. Declare pointers to data structures.
    3. Declare pointers to classes.
    4. Use a pointer to store and retrieve data from any of the 6 basic C data types (char, short, int, long, float, double).
    5. Use a pointer to store and retrieve data from a data structure given a static instance of a structure (dot notation, i.e. s.val) and a pointer to a dynamic instance of a structure (pointer notation, i.e. s->val).
    6. Use a pointer to access public fields and functions in an instantiation of a class.
    7. Pass an address stored in a pointer variable to a function that is expecting a pointer as an argument and have that function read and/or write a value into the variable using the pointer.
    8. Pass the address of a variable to a function that is expecting a pointer as an argument and have that function read and/or write a value into the variable using the pointer.
    9. Use the new operator to dynamically allocate memory for variables, data structures, and classes and set pointers pointing to them.
    10. Create a call-by-reference function in C++ and make calls to that function.
  5. Data Structures
    You should be able to define data structures for each of the following uses:
    1. Declare a simple data structure.
    2. Declare a nested data structure, i.e. one that contains another data structure.
    3. Declare a data structure containing a pointer to a structure of the same type.
    4. Store and retrieve data in a data structure given a pointer to the data structure, i.e. (using "->").
    5. Store and retrieve data in a data structure given the name of the data structure variable, i.e. (using "dot" notation).
    6. Declare a Stack class containing a pointer to a StackItem structure which can be used to implement a stack as a linked type.
    7. Declare a Queue class containing a pointer to a QueueItem structure to be used to implement a queue as a linked type.
    8. Declare a data structure to be used in creating a linked list.
    9. Declare a data structure to be used in creating a binary tree.
    10. Declare the data structures and arrays needed to implement a graph as an adjacency matrix.
    11. Declare the data structures needed to implement a graph as an adjacency set.
  6. Algorithms
    1. Lists, Stacks, and Queues
      • Be able to write the real or pseudocode for the Push() function in a stack implemented as a linked list.
      • Be able to write the real or pseudocode for the Pop() function in a stack implemented as a linked list.
      • Be able to write the real or pseudocode for the Enqueue() function in a queue implemented as a linked list.
      • Be able to write the real or pseudocode for the Dequeue() function in a queue implemented as a linked list.
      • Be able to write the real or pseudocode for the Insert() function in a linked list.
      • Be able to write the real or pseudocode for the Delete() function in a linked list.
      • Be able to write the real or pseudocode for the Search() function in a linked list.
    2. Trees
      • Given the real code for the Insert() function in a binary tree be able to fill in the blanks.
      • Given the real code for the Delete() function in a binary tree be able to fill in the blanks.
      • Given the real code for the Search() function in a binary tree be able to fill in the blanks.
      • Show the real code for performing a recursive, in-order traversal of a binary tree.
    3. Graphs
      • Explain how the basic search algorithm works when the "to visit" node list is implementing as a stack and as a queue.
      • Explain how the basic algorithm works for constructing a minimal spanning tree. (Only general approach, details not required)
      • Explain how the basic algorithm works for determining the shortest path. (Only general approach, details not required)
    4. Sets
      • What is the Union of two sets? Given example sets (A and B) show what the Union of A and B would contain. What symbol is used to represent the Union operation.
      • What is the Intersection of two sets? Given example sets (A and B) show what the Intersection of A and B would contain. What symbol is used to represent the Intersection operation.
      • What is the Difference of two sets? Given example sets (A and B) show what the Difference of A and B would contain.
      • What is the Symmetrical Difference of two sets? Given example sets (A and B) show what the Symmetrical Difference of A and B would contain.
    5. Hashing
      • Show the real code for a Base-26 hash function which gets passed a 4-character string and returns a hash index as an int. Assume table size is defined as TS
      • Show in real code or pseudocode how to calculate a hash function using Folding.
      • Show in real code or pseudocode how to calculate a hash function using Middle Squaring.
      • Show in real code or pseudocode how to calculate a hash function using Truncation.
      • Show in real code or pseudocode how to calculate a hash function using Division Method.
    6. Sorting (You should know a one or two sentence description of how the sort works. A detailed algorithm is not required.)
      • Comparison-based sorting
        1. Transposition Sorting
          1. Bubble Sort
        2. Insert and Keep Sorting
          1. Insertion Sort
          2. Tree Sort
        3. Priority Queue Sorting
          1. Selection Sort
          2. Heap Sort
        4. Divide and Conquer Sorting
          1. Quick Sort
          2. Merge Sort
        5. Diminishing Increment Sorting
          1. Shell Sort
      • Address calculation sorting
        1. Proxmap Sorting
        2. Radix Sorting
  7. Object Oriented Programming (C++)
    You should know how to do the following in C++
    1. Declare a class in C++
    2. Use Stream IO (cout, cin, and the operators << and >>)
    3. Declare variables in C++
    4. Declare and use variables of the appropriate scope (public, private, or protected).
    5. Define and use overloaded functions.
    6. Declare and use function templates.
    7. Create and use namespaces.