首页 > 代码库 > Singly linked list algorithm implemented by Java
Singly linked list algorithm implemented by Java
Jeff Lee blog: http://www.cnblogs.com/Alandre/ (泥沙砖瓦浆木匠),retain the url when reproduced ! Thanks
Linked list is a normal data structure.here I show how to implements it.
Step 1. Define a structure
public class ListNode{ public ListNode Next; public int Value; public ListNode(int NewValue) { Value = http://www.mamicode.com/NewValue;>Step 2. implements the functions
public class Clist{ private ListNode Head; private ListNode Tail; private ListNode Current; private int ListCountValue; public Clist() { ListCountValue = http://www.mamicode.com/0;>Step 3. Test class for testing
public class Test{ public static void main(String[] args) { Clist clist = new Clist(); clist.Append(12); clist.Append(22); clist.Insert(66); clist.Insert(33); clist.Delete(); clist.printAllListNode(); }}
we will see:
12226633Singly linked list algorithm implemented by Java
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。