* PRE: head is the first node in a linked_list (if NULL, linked_list is empty)
* POST: a new vector<int> containing the keys in the correct order has been
returned.
*/
std::vector<int>* to_vector(Node* head){
std::vector<int>* result = new std::vector<int>();
for (Node* curr = head; curr != NULL; curr = curr->next ){
result->push_back(curr->key);
}
return result;
}
/**
* Delete the last Node in the linked_list
* PRE: head is the first Node in a linked_list (if NULL, linked_list is empty)
* POST: the last Node of the linked_list has been removed
* POST: if the linked_list is now empty, head has been changed
*/
void delete_last_element(Node*& head){

// ******** WRITE YOUR CODE HERE ********
Node **cnode = &head;
while (cnode[0] != NULL && cnode[0]->next != NULL){
cnode = &cnode[0]->next;
}
delete *cnode;
*cnode = NULL;
}
/**
* Removes an existing Node (with key=oldKey) from the linked_list.
* PRE: head is the first node in a linked_list (if NULL, linked_list is empty)
* PRE: oldKey is the value of the key in the Node to be removed
* PRE: if no Node with key=oldKey exists, the linked_list has not changed
* POST: if a Node with key=oldKey was found, then it was deleted
* POST: other Nodes with key=oldKey might still be in the linked_list
*/
void remove(Node*& head, int oldKey) {
// ******** WRITE YOUR CODE HERE ********

