数据结构代写 | 算法代写 | python代写 – Take-home assignment

数据结构代写 | 算法代写 | python代写: 这是一个利用python进行基本的算法实现的题目
Q1. Implement bubble sort for a 10 node array.
One example of the definition of node class please see the attachment,
and the values inside each node are {9, 2, 4, 8, 5,15, 8, 20, 5, 1}.

Sample output:
Original array:
3, 2, …
Output array:
2, 3, …, 9…

Q2. Make the bubble sort method in a sort class, and which can support to sort double array, and integer array and node array.

Submission:
Submit to me as .zip file such as submit 88188.zip file to me.
inside it:
a. the zip file will include .java source file, as well as
b. a readme to include instructions about how to run/test the code;
c. a .log file to include the result of the code.

Attachment:
1. Node class definition:
class Node
{
protected int data;
/* Constructor */
public Node() {
data = 0;
}
/* Constructor */
public Node(int data) {
this.data = data;
}
public void setData(int d) {
data = d;
}
public int getData() {
return data;
}
}

2. how to initiate the Node array:

Node[] myList = new Node [5];
for (int i = 0; i < 5; i++) { myList[i] = new Node (5); }

发表评论

电子邮件地址不会被公开。 必填项已用*标注