Exam 1 Review, CS 250

Topics:

  • STL Structures - Vector and List
  • Pointers
  • Dynamic variables and arrays
  • Linked Lists

Question Breakdown:

#QuestionWeight
1 STL Structures 8%
2 Graph identification 12%
3 Pointers 12%
4 Random/sequential access 8%
5 Linked list diagrams 24%
6 Coding - dynamic variables/arrays 10%
7 Coding - node 11%
8 Coding - linked list 15%

Things to know:

STL Structures

  • STL Vectors
  • The STL vector is implemented via a dynamic array
  • Its main functions are: push_back(), pop_back(), and operator[]
  • You can randomly access items in a vector (or a dynamic array-based structure).
  • STL List
  • The STL list is implemented via a linked lists
  • Its main functions are: push_back(), push_front(), pop_back(), pop_front()
  • You cannot randomly access items in a list (or a linked list structure) - you have to access them sequentially.

Pointers and dynamic variables/arrays

  • What are variables (including pointer variables) initialized to by default in C++?
  • Safety - What do you set a pointer to when it isn't being used?
  • What is a memory leak? How is it caused?
  • How do you allocate memory and deallocate memory for a dynamic variable?
  • How do you allocate memory and deallocate memory for a dynamic array?

Linked Lists

  • What member variables are included in the Node part of a Linked List?
  • What member variables are included in the LinkedList part of a Linked List?

Diagramming Linked Lists:

  • Be able to diagram an empty linked list
  • Be able to diagram a linked list after PushBack( something )
  • Be able to diagram a linked list after PushFront( something )
  • Be able to diagram a linked list after PopBack()
  • Be able to diagram a linked list after PopFront()
  • Be able to diagram a linked list after Insert( something ) (between two other nodes that already exist)

Coding Linked Lists:

  • Be able to write out the function definition for PushBack(T data)
  • Be able to write out the function definition for PushFront(T data)
  • Be able to write out the function definition for PopBack()
  • Be able to write out the function definition for PopFront()
  • Be able to write out the function definition for operator[]()