avatar
H*e
1
希望static node fromArray(int[] a) {...}中的head或者tail只用到一个, 应该如何
update codes? Expect working codes in visual studio with only head or tail,
which mean eliminate the head or tail. Just 1 variable, no constructor. :)
hint:
You do not need double-linked list. Just think, why do we have head and tail
variables. We do not do anything with head except initial assignment.
class node
{
public int value;
public node next = null;
static node fromArray(int[] a)
{
if (a.Count() == 0) return null;
else
{
node head = new node();
node tail = head;
for (int i = 0; i < a.Count(); i++)
{
tail.value = a[i];
if (i != a.Count() - 1)
{
tail.next = new node();
tail = tail.next;
}
}
return head;
}
}
static void Main(string[] args)
{
int[] c = new int[] { 11, 2, 3 };
node my_list = node.fromArray(c);
while (my_list != null)
{
Console.WriteLine(my_list.value);
my_list = my_list.next;
}
Console.ReadLine();
}
}
avatar
G*Y
2
ipad2的缺点是太小,
如果把显示器面积加倍搞成ipad4
我觉得就更适合学校里使了
avatar
A*s
3
算了吧
学校是教育人的地方

【在 G**Y 的大作中提到】
: ipad2的缺点是太小,
: 如果把显示器面积加倍搞成ipad4
: 我觉得就更适合学校里使了

avatar
G*Y
4
那就装上windows,配个笔。
我就很满意了。

【在 A*****s 的大作中提到】
: 算了吧
: 学校是教育人的地方

avatar
s*s
5
这个叫iBoard.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。