The assigned reading prior to Tuesday, January 15th is an overview of data structures and a review of complexity analysis. Please refer to:
Data Structures and Other Objects Using C++:
If you do not have the primary textbook, you can use the following free alternative texts instead:
Data Structures & Algorithm Analysis
The readings prior to Tuesday, January 22nd focus on C++ templates and memory management, and an exploration of basic sequence containers such as dynamic arrays, linked lists
Data Structures and Other Objects Using C++:
If you do not have the primary textbook, you can use the following free alternative texts instead:
Data Structures & Algorithm Analysis
Once you have completed the readings, answer the following questions:
In the context of data structures, why would using a language with templates be advantageous?
In C++ Templates Tutorial, the author provides the following class template:
//stack.h #pragma once template <class T> class Stack { public: Stack(int = 10) ; ~Stack() { delete [] stackPtr ; } int push(const T&); int pop(T&) ; // pop an element off the stack int isEmpty()const { return top == -1 ; } int isFull() const { return top == size - 1 ; } private: int size ; // Number of elements on Stack int top ; T* stackPtr ; } ;
Unfortunately, this class violates the Rule of Three. Explain what this violation is, why it is problematic, and what you would do to fix it.
What is the difference between a vector's size and capacity? How do these properties influence the insert operation?
Suppose I wanted to implement a sequence container by using an linked list. What would be the complexity in terms of Big-O for the following operations:
To submit your reading assignment, you must upload a text/PDF file onto Canvas prior to class