Search the whole station

数据结构考试代考 Java代码代写 数据结构代写 数据结构代考

Midterm 2

数据结构考试代考 Question 1   25 pts Your task for this question is to create a Node class by implementing an interface. To begin, the following interface is provided

Question 1   25 pts

Your task for this question is to create a Node class by implementing an interface. 

To begin, the following interface is provided. All details are explained for each method in this interface and so read it carefully. For your response add a section title called “[ MY ANSWER ]” in the text field, and then implement your Node class below. Name your class to whatever you like it to be, and show all code for this work; i.e. show your class definition and method definitions.. Use comments in the code when needed.

public interface INode
{
/*
* Method      : setData
* Description :
* 1) Sets the member data field of the current node
  */
public void setData(int data);

/*
* Method      : getData
* Description :
* 1) Returns the value of member data field of the current node
*/
  public int getData();

/*
* Method      : setNextNode
* Description :
* 1) Sets the member next node field of the current node
* NOTE: You MUST handle when there is an existing next node, and for when there is not a next node existing. You MUST also check if input parameter is a null.
* NOTE: If there is an existing next node, then that node will become the next node of the next node you are trying to set for the current node
* i.e. 0) current Node is A
* 1) current linked list is A-->E-->F
* 2) action ==> insert node B as next node for node A
  *      3) the result should be ==> A-->B-->E-->F
  * NOTE: If the input parameter is null, then set the next node as null.
  */
public void setNextNode(Node node);

  /*
  * Method      : getNextNode
  * Description :
  * 1) Returns the node reference of the member next node field of the current node
  */
  public Node getNextNode();
}

Question 2        50 pts 数据结构考试代考

Your task for this question is to create a LinkedList class by implementing an interface. 

To begin, the following interface is provided. All details are explained for each method in this interface and so read it carefully. For your response add a section title called “[ MY ANSWER ]” in the text field, and then implement your LinkedList class below. Name your class to whatever you like it to be, and show all code for this work; i.e. show your class definition and method definitions.. Use comments in the code when needed.

public interface ILinkedList
{
/* You are expected to complete an implemented class that has the essential
  * details in the class implementation
  * (you should know what these are)
  */

/*
* Method      : totalNodeCount
* Description :
* 1) Counts the total number of nodes in the linked list
  * 2) returns the total count
  */
  public int totalNodeCount();

 /*
  * Method      : findNode
  * Description :
  * 1) Does a search for the Node that contains the data value
  * 2) returns the Node that contains the data
  * - if node is not found return null, else return the node
  */
  public Node findNode(int value);

 /*
  * Method      : insertNode
  * Description :
  * 1) This method will insert a new node. with the data, at the tail of the linked list
  * NOTE: ensure you take care of all corner cases (you should know these)
  */
  public void insertNode(int data);

/*
  * Method      : insertAfterNode
  * Description :
  * 1) Takes two parameters (the node to insert, and the source node)
* 2) The node to insert will be added after the source node
  * - hint, use what you already created for Node class
  */
  public void insertAfterNode(Node nodeToInsert, Node sourceNode);

 /*
  * Method      : removeNode
  * Description :
  * 1) Finds the node that contains the data
  * 2) Remove the node from the list
  * NOTE: ensure you take care of all corner cases (you should know these)
*
  */
  public void removeNode(int data);
}

Question 3        10 pts 数据结构考试代考

Your task for this question is to create a WeirdNode class by implementing an interface. 

To begin, the following interface is provided. All details are explained for each method in this interface and so read it carefully. For your response add a section title called “[ MY ANSWER ]” in the text field response, and then implement your WeirdNode class below. Name your class to whatever you like it to be, and show all code for this work; i.e. show your class definition and method definitions.. Use comments in the code when needed.

public interface IWeirdNode
{
/*
  * Method      : setOtherNextNode
  * Description :
  * 1) This method will create a new node with a data value
  *  2) It will insert the new node after the other next node.
  *  NOTE: only be concerned with this scenario and assume that the linked list has plenty of nodes
  *   NOTE: do not worry about other corner case scenarios
  *
  *   i.e. 1) assume the following linked list exists:
  *       A-->B-->C-->D-->E--F-->G
  *     2) Assume sourceNode == node C
  *      3) Assume the new node with value is node K
  *   4) End result will be ==> A-->B-->C-->D-->E-->[K]-->F-->G
  */
  public Node insertOtherNextNode(int value, Node sourceNode);
}

Question 4            10 pts 数据结构考试代考

Assume a queue node is defined as the following:

public class QueueNode
{
private int data;
  private Node theQueueNode;
  /* etc. */
}

Assume that there is a QueueList class that has member variable: “QueueNode head;”

If implementing a method called “QueueNode removeFromQueue(int data)”, describe the steps that you would perform at high level. There should only be a couple steps. Please write one step per line and be concise. For your response, first add a section title called “[ MY ANSWER ]” in the text field response, and the write your response below it.

For example:

[ MY ANSWER ]

Step 1: do this

Step 2: do that

Step 3: then do this

Step 4: etc.

Question 5       5 pts

For a multi-node tree, explain in two to three sentences on what is the difference between a leaf of tree and sub-tree?

For your response add a section title called “[ MY ANSWER ]” in the text field response, and then add your response.

数据结构考试代考
数据结构考试代考

更多代写:Cs美国大学排名  托福家庭版作弊  英国Finance代考  Finance金融学Essay代写  his历史学写作 数据结构代考

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

The prev: The next:

Related recommendations

1
您有新消息,点击联系!