Starting from:

$29.99

Lab 09 - Nodes & Maps Problems

Lab 09 - Nodes & Maps Problems
Direction: Submit typed work in the Labs directory of your github repositor or dropbox, or upload to the google classroom
assignment. Each part will have a template file provided named ''lab9A.cpp'' and ''lab9B.h'' respectively.
Part A: In class
Your objective is to write the definition of the function HasCycle() whose header is
bool HasCycle(Node<T>* root)
template<typename T>
Given that root is referencing a singly linked list, the function returns true if the linked list referenced by root has a
cycle; otherwise, it returns false. A linked list has a cycle if the link of a node is equal to a previous node in the linked
list.
Part B: Take home
Your objective is to define all the methods of the class MyCalendar. The class MyCalendar allows users to book
events for a range of days; however, it prohibits more than 2 events to overlap. Its methods are
 A default constructor. It initializes the calendar to 365 days with no events booked.
 A overloaded constructor that takes a ulong parameter. Given that the parameter represents a year, it initializes
the calendar to the amount of days in the year the parameter represents with no events booked.
 A copy constructor.
 A assignment operator.
 A destructor.
 A bool method Book() that takes two ulong parameters named start and end respectively. If start and end
are both less than the number of days in the year, start is less than end, and booking the event does not
cause an overlap of more than 2, the function adds the event to the calendar and returns true. Otherwise, the
function returns false.

More products