Question
Question: Note all the functions you will need to implement and explanations for each are provided for you in the hpp so we won't go
Question: Note all the functions you will need to implement and explanations for each are provided for you in the hpp so we won't go too in depth into what you need to do for each function.
IMPORTANT: SOMETHING TO CLEAR UP ABOUT POSITION: Alright so we've always known as the first element being index 0. But note for this particular project there is no position 0, we start from position 1. So inserting at position 1 is inserting at the head of the list. Inserting 0 should be out of bounds in this case. This is so counter intuitive, why would you do that? Honestly, sometimes life just throws a curveball at you. Meaning I don't know but after being halfway through making this project there was no shot I was going to change it. But hey, just make sure to account for that in your functions! What do you mean by "case": An edge case is a certain scenario your program will run into in which you will need to account for. For example for insert I give you the list of basic cases you need to check for: * Handles edge case of an invalid position parameter * Case: Inserting into head of the list * Case: Inserting into rear of the list * Case: Inserting into a position that is not an extremity This means you should have various if statements checking to see which position you are actually inserting in. If it's position 1 (the beginning of the list) then it will clearly be different than inserting an element in the middle of the list. Think about why. If we are inserting in the beginning of the list then our element is going to be the new head pointer. But if we are inserting in the middle then the previous will be an actual element. But if we are inserting at the end of the list then the next pointer will just point to nullptr. The clear function and copy constructor: The clear function won't just simply set the item count to zero unfortunately, just like how the copy constructor won't simply repoint to the parameter but will make something known as a deep copy.
DoubleNode.hpp
#ifndef DOUBLE_NODE_
#define DOUBLE_NODE_
template
class DoubleNode
{
public:
DoubleNode(); //default constructor, sets next_ and prev_ to nullptr
DoubleNode(const ItemType &anItem, DoubleNode
void setItem(const ItemType &anItem); //sets item_ equal to anItem parameter
void setPrevious(DoubleNode
void setNext(DoubleNode
ItemType getItem() const; //returns item_
DoubleNode
DoubleNode
private:
ItemType item_; //actual content of your node
DoubleNode
DoubleNode
};
#include "DoubleNode.cpp"
#endif
DoublyLinkedlist.hpp
#ifndef DOUBLY_LINKED_LIST_
#define DOUBLY_LINKED_LIST_
template
class DoublyLinkedList
{
public:
DoublyLinkedList(); //default constructor, sets headPtr_ to null and itemCount_ to 0
/*
Copy constructor that will make an exact copy of the list parameter, aList.
This will make a deep copy of the list in the given parameter.
You must iterate through the callee list parameter and insert nodes from aList into the caller list (the current one that isn't the parameter)
*/
DoublyLinkedList(const DoublyLinkedList &aList);
~DoublyLinkedList(); //destructor that calls the clear function
int getSize() const; //return itemCount_
/* *
* Description: finds the node at parameter pos
* Pre: pos is a valid place in the list, otherwise nullptr will be returned
* Post: returns a pointer to the node at pos
* */
DoubleNode
DoubleNode
/* *
* Description: inserts parameter item in caller list at parameter position
*IMPORTANT: Position 1 is the first position, not 0
* Pre: position is a valid place within the list, otherwise false will be returned
* Post: returns true if the item has been inserted in the caller list
* Handles edge case of an invalid position parameter
* Case: Inserting into head of the list
* Case: Inserting into rear of the list
* Case: Inserting into a position that is not an extremity
* */
bool insert(const ItemType &item, const int &position = 1);
/* *
* Description: removes node at parameter position
*IMPORTANT: Position 1 is the first position, not 0
* Pre: position is a valid place within the list, otherwise false will be returned
* Post: returns true if the item at position has been removed from the caller list
* Handles edge case of invalid position parameter
* Case: removing only node in list
* Case: removing from the end
* Case: removing from the beginning
* Case: removing from a position that is not an extremity
* */
bool remove(const int &position);
bool isEmpty() const; //returns true if itemCount_ is 0
/* *
* Description: removes all items from the caller list
* Traverse through the linked list and delete each individual node
* Post: no nodes remain in the list and itemCount_ is at 0
* */
void clear();
//Iteratively outputs the contents of the caller list on the console
//Example "A B C D E"
//Note how theres no space at the end
void display() const;
//Iteratively outputs the contents of the caller list backwards on the console
//Example if we had A B C D E we would instead display "E D C B A"
void displayBackwards() const;
// Reverses the list such that if my list was A B C D it will now be D C B A
// Remember to change both previous and next pointers
// Will be tested with both display and displayBackwards, make sure you have those working
void invert();
private:
DoubleNode
int itemCount_; //lists how many items are currently in the list
};
#include "DoublyLinkedList.cpp"
#endif
question 1
Given 100 $2 + 10v2s + 100 do each of the following: a Compute w (Natural frequency) b Compute ( (Damping ratio) C Compute wa (Damped natural frequency) d Compute Mp (Overshoot) e Compute o (Real part of poles) f Compute t, (Settling time to get within 1% of final output value) g Compute to (Rise time) h Compute to (Peak time)Give a description of the computational model and architecture of the MapReduce model of computation. Explain why failure must be tolerated within a significant set of "worker" machines, but not in the "master" machine. Describe the underlying model of failure probability in individual machines that makes this apparent paradox an acceptable engineering compromise.Give a description of the computational model and architecture of the MapReduce model of computation. Explain why failure must be tolerated within a significant set of "worker" machines, but not in the "master" machine. Describe the underlying model of failure probability in individual machines that makes this apparent paradox an acceptable engineering compromise.Prof. Nicola Dimitri Available time: 90 Minutes 1. (11 points) In the General Equilibrium with banks model discussed in class suppose consumers have the following utility function U(c ,c) = c, + logcz and that the firms production function is f(I) = log (1 + 1) where c ,c, 1 2 0. Find the General Equilibrium values of quantities and prices of this economy 2 (11 points) Consider the Diamond-Dybvig model for banks as liquidity providers, in case of negative shocks, discussed in class. Suppose u(c) = c with 0Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started