数据结构之链表

来源:互联网 发布:域名论坛网站 编辑:程序博客网 时间:2024/06/14 02:20
//方法:获取单链表的长度public int getLength(Node head) { if (head == null) { return 0; }  int length = 0; Node current = head; while (current != null) { length++; current = current.next; }  return length;}

链表
0 0
原创粉丝点击