zoukankan      html  css  js  c++  java
  • jQuery火箭图标返回顶部代码

    
    /**
     * 循环链表
     */
    
    public class CycleLinkedList
    {
        private static final String TAG = "CycleChain";
        private int size = 0;
        private LinkedNode head = null;//头结点,相当于一个标签而已,不是链表众多节点的一部分
        private LinkedNode cur = null;//记录插入之前时候的head的位置
    
        class LinkedNode
        {
            Object value;
            LinkedNode next = null;
    
            LinkedNode(Object obj)
            {
                this.value = obj;
            }
        }
    
        public boolean isEmpty()
        {
            return size == 0;
        }
    
        public int getSize()
        {
            return size;
        }
    
        public void insertHead(Object obj)
        {
            LinkedNode node = new LinkedNode(obj);
            if (head == null)
            {
                node.next = head;
                head = node;
                cur = head;
                head.next = head;
            } else
            {
                while (head.next != cur)
                {
                    head = head.next;
                }
                head.next = node;
                head = node;
                head.next = cur;
                cur = head;
            }
            size++;
        }
    
        public void deleteHead() throws Exception
        {
            if (head == null) throw new Exception("空链表!");
            while (head.next != cur)
            {
                head = head.next;
            }
            cur = cur.next;
            head.next = cur;
            head = cur;
        }
    
        public void display() throws Exception
        {
            if (head == null) throw new Exception("空链表!");
            LinkedNode cur = head;
            int i = 0;
            while (cur != null && i < getSize() * 4)
            {
                System.out.print(cur.value.toString() + "->");
                cur = cur.next;
                i++;
            }
            System.out.println("");
        }
    
        public static void main(String[] args) throws Exception
        {
            CycleLinkedList cc = new CycleLinkedList();
            cc.insertHead("哈哈");
            cc.insertHead("ds");
            cc.insertHead("123123你好");
            cc.insertHead("ggt");
            cc.display();
            System.out.println("---");
            cc.deleteHead();
            cc.deleteHead();
            cc.insertHead("test!");
            cc.display();
            System.out.println("---");
    
            System.out.println(cc.getSize());
    
        }
    
    }
  • 相关阅读:
    抓取当前界面上任意控件图像的C#代码
    Visual Studio 2005各版本之间的区别
    CSDN上一个问题的回答
    RichTextBox的线程安全问题
    2005年LOGO设计趋势
    VB中的奇怪错误
    吴裕雄天生自然SPRINGSpring MVC的基本配置
    吴裕雄天生自然SPRING基于Java配置的Spring MVC应用
    吴裕雄天生自然SPRINGJSON数据交互
    吴裕雄天生自然SPRING基于注解的控制器
  • 原文地址:https://www.cnblogs.com/prayjourney/p/12528110.html
Copyright © 2011-2022 走看看