{"id":2396,"date":"2017-12-23T11:07:36","date_gmt":"2017-12-23T03:07:36","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=2396"},"modified":"2017-12-23T11:07:36","modified_gmt":"2017-12-23T03:07:36","slug":"java%e5%ae%9e%e7%8e%b0%e8%b7%b3%e8%a1%a8%ef%bc%88skiplist%ef%bc%89","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=2396","title":{"rendered":"java\u5b9e\u73b0\u8df3\u8868\uff08SkipList\uff09"},"content":{"rendered":"<p>\n\t\u524d\u9762\u7684\u300a<a href=\"http:\/\/www.xttblog.com\/?p=2393\" name=\"\u4ece\u6454\u9e21\u86cb\u95ee\u9898\u8bb2\u8df3\u8868\u7684\u539f\u7406\" target=\"_blank\" title=\"\u4ece\u6454\u9e21\u86cb\u95ee\u9898\u8bb2\u8df3\u8868\u7684\u539f\u7406\">\u4ece\u6454\u9e21\u86cb\u95ee\u9898\u8bb2\u8df3\u8868\u7684\u539f\u7406<\/a>\u300b\u4e2d\uff0c\u6211\u7b80\u5355\u8bf4\u4e86\u4e0b\u8df3\u8868\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u9650\u4e8e\u7bc7\u5e45\u6ca1\u6709\u5b9e\u73b0\u4ee3\u7801\uff0c\u53ea\u662f\u5217\u4e3e\u4e86\u7b97\u6cd5\u548c\u601d\u8def\u3002\u672c\u6587\u4f7f\u7528java\u6765\u5b9e\u73b0\u4e00\u4e2a\u8df3\u8868\u7b97\u6cd5\u3002\n<\/p>\n<p>\n\t\u76f4\u63a5\u4e0a\u4ee3\u7801\uff0c\u5982\u4e0b\uff1a\n<\/p>\n<pre class=\"brush:java;\">\r\npackage com.xttblog.list;\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.HashMap;\r\nimport java.util.Iterator;\r\nimport java.util.List;\r\nimport java.util.Map;\r\nimport java.util.Random;\r\n \r\n\/**\r\n * @author \/\/www.xttblog.com\r\n *\r\n *  \u5728\u8fd9\u91cc\u6211\u4e5f\u4ece\u7f51\u4e0a\u67e5\u4e86\u4e00\u4e9b\u5173\u4e8e\u8df3\u8868\u7684\u8d44\u6599\uff0c\u53d1\u73b0\u4e86\u8df3\u8868\u7684\u4e24\u79cd\u6570\u636e\u7ed3\u6784\u7684\u8bbe\u8ba1\r\n *  1. class Node{\r\n *      int data; \/\/\u7528\u4e8e\u5b58\u653e\u6570\u636e\r\n *      Node next;\/\/\u7528\u4e8e\u6307\u5411\u540c\u4e00\u5c42\u7684\u4e0b\u4e00Node\r\n *      Node down;\/\/\u7528\u4e8e\u6307\u5411\u5728\u6570\u636e\u76f8\u540c\u7684\u4e0b\u4e00\u5c42Node   \r\n *  }\r\n *  2. class Node{\r\n *      int data;\r\n *      Node[] forword; \/\/\u770b\u56fe\u53ef\u4ee5\u8bf4\u660e\u4e00\u5207\uff0c\u7528\u4e8e\u6307\u5411\u53ef\u4ee5\u5230\u8fbe\u7684\u8282\u70b9\r\n *                      \/\/\u968f\u673a\u9ad8\u5ea6\u6570 k\u51b3\u5b9a\u8282\u70b9\u7684\u9ad8\u5ea6 h\uff0c\u8282\u70b9\u7684\u9ad8\u5ea6 h\u51b3\u5b9a\u8282\u70b9\u4e2dforword\u7684\u957f\u5ea6\uff1b\r\n *  }\r\n *\r\n *  \u6bd4\u8f83\u4e0a\u9762\u7b2c\u4e00\u79cd\u548c\u7b2c\u4e8c\u79cd\u6570\u636e\u7ed3\u6784:\u6211\u9009\u62e9\u4e86\u7b2c\u4e8c\u79cd\uff0c\u56e0\u4e3a\u6211\u76ee\u524d\u89c9\u5f97\r\n *  \u4f8b\u5982\uff1a\u65b0\u6dfb\u52a0\u4e00\u4e2a\u8282\u70b9\uff0c\u8282\u70b9\u7684\u9ad8\u5ea6\u4e3a10\uff0c\u8282\u70b9\u6570\u636e\u4e3a2\uff0c\u91c7\u7528\u7b2c\u4e00\u79cd\u7ed3\u6784\uff0c\u5b83\u5fc5\u5b9a\u8981new 10\u4e2aNode\uff0c\u7136\u540e\u8fd8\u5f97\u5b58\u50a8\u76f8\u540c\u7684\u6570\u636e2\uff0c\r\n *  \u867d\u7136down\u548cnext\u4f1a\u6709\u4e0d\u4e00\u6837\uff0c\u4f46\u8fd8\u662f\u6d6a\u8d39\u3002\u5982\u679c\u662f\u7b2c\u4e8c\u79cd\u7ed3\u6784\uff0c\u53ea\u9700new \u4e00\u4e2aNode\uff0c\u7136\u540eNode\u4e2d\u7684forward\u957f\u5ea6\u8bbe\u4e3a10\uff0c\u5c31\u8fd9\u6837\u3002\r\n *  \u867d\u7136JVM\u5728\u521b\u5efa\u5bf9\u8c61\u65f6\u5bf9\u5bf9\u8c61\u4e2d\u7684\u5f15\u7528\u548c\u6570\u7ec4\u662f\u4e0d\u4e00\u6837\u7684\uff08next\u548cdown\u662f\u7eaf\u7cb9\u7684\u5f15\u7528\uff0c\u800cforward\u662f\u5f15\u7528\u6570\u7ec4\uff09\uff0c\u4f46\u6211\u76f8\u4fe1new\u4e00\u6b21\u5e94\u8be5\u6bd4new\r\n *  10\u6b21\u8017\u65f6\u66f4\u5c11\u5427\u3002\r\n *  \/\/www.xttblog.com\r\n *\/\r\npublic class SkipList {\r\n    private class Node{\r\n        \/\/\u5b58\u50a8\u7684\u6570\u636e\uff0c\u5f53\u7136\u4e5f\u53ef\u4ee5\u7528\u6cdb\u578b\r\n        int data;\r\n        \/\/leavel\u5c42\u6570\u7ec4\r\n        Node[] forword;\/\/www.xttblog.com\r\n        \/\/int index; \/\/\u8fd9\u4e2a\u53d8\u91cf\u662f\u4e13\u95e8\u4e3a\u4e86\u540e\u9762\u7684\u8f93\u51fa\u597d\u770b\u6dfb\u52a0\u7684\u3002\r\n                    \/\/\u8fd9\u4e2a\u5b8c\u5168\u6ca1\u6709\u5fc5\u8981\u4e3a\u4e86\u597d\u770b\u5c31\u53bb\u505a\uff0c\u56e0\u4e3a\u4e00\u65e6\u8fd9\u6837\u505a\u4e86\uff0c\u90a3\u4e48\u5728\u6570\u636e\u8df3\u8868\u4e2d\u6709\u4e86\u76f8\u5f53\u591a\u7684\u6570\u636e\u8282\u70b9N\u65f6\uff0c\u5f88\u4e0d\u5e78\uff08\u4e5f\u5c31\r\n                    \/\/\u662f\u5728\u6700\u574f\u7684\u60c5\u51b5\u4e0b\uff09\uff0c\u5982\u679c\u518d\u6dfb\u52a0\u4e00\u4e2a\u65b0\u7684\u5143\u7d20\uff0c\u800c\u8fd9\u4e2a\u5143\u7d20\u6070\u597d\u5728header\u540e\u9762\u7684\u7b2c\u4e00\u4e2a\u4f4d\u7f6e\uff0c\u8fd9\u4f1a\u5bfc\u81f4\u540e\u9762\u7684\u6240\u6709\u7684\r\n                    \/\/\u7684\u8282\u70b9\u90fd\u8981\u53bb\u4fee\u6539\u4e00\u6b21index\u57df\uff0c\u4ece\u800c\u8981\u53bb\u904d\u5386\u6574\u4e2a\u8df3\u8868\u7684\u6700\u5e95\u5c42\u3002\u5927\u5927\u7684\u7cdf\u7cd5\u900f\u9876\uff01\r\n        public Node(int data, int leavel){\r\n            this.data = data;\r\n            this.forword = new Node[leavel];\r\n            \/\/this.index = index;\r\n        }\r\n        public String toString(){\r\n            return &quot;[data=\"+data+\", height=\"+forword.length+\"] --&gt;&quot;;\r\n        }\r\n    }\r\n    \/\/\u56e0\u4e3a\u6211\u77e5\u9053\u8df3\u8868\u662f\u4e00\u4e2a\u975e\u5e38\u4f18\u79c0\u7684\u4ee5\u7a7a\u95f4\u6362\u65f6\u95f4\u7684\u6570\u636e\u7ed3\u6784\u8bbe\u8ba1,\r\n    \/\/\u4e14\u5176\u6027\u80fd\u5728\u63d2\u5165\u3001\u5220\u9664\u751a\u81f3\u8981\u6bd4\u7ea2\u9ed1\u6811\u9ad8\u3002\r\n    \/\/\u6240\u4ee5\u6211\u4f1a\u6beb\u4e0d\u541d\u556c\u7684\u6325\u970d\u5185\u5b58\r\n    private static final int DEFAULT_LEAVEL = 3;\r\n    \/\/\u5f00\u59cb\u6807\u5fd7\uff0c\uff08\u6211\u6253\u7b97\u8bbe\u7f6e\u5176\u6570\u636e\u9879\u4e3aInteger.MIN_VALUE\uff09\r\n    private Node header;\r\n    \/\/\u7ed3\u675f\u6807\u5fd7\uff0c\uff08\u6211\u6253\u7b97\u8bbe\u7f6e\u5176\u6570\u636e\u9879\u4e3aInteger.MAX_VALUE\uff09\r\n    private Node nil;\r\n    \/\/\u5f53\u524d\u8282\u70b9\u4f4d\u7f6e\r\n    private Node current;\/\/ \u8fd9\u4e00\u53d8\u91cf\u662f\u4e3a\u4e0b\u9762\u7684add_tail\uff08\uff09\u65b9\u6cd5\u91cf\u8eab\u6253\u9020\u7684\r\n \/\/www.xttblog.com\r\n    private Random rd = new Random();\r\n \/\/www.xttblog.com\r\n    public SkipList(){\r\n        \/\/\u65b0\u5efaheader\u548cnil\r\n        header = new Node(Integer.MIN_VALUE, DEFAULT_LEAVEL);\r\n        nil = new Node(Integer.MAX_VALUE, DEFAULT_LEAVEL); \/\/\u8fd9\u91cc\u628a\u5b83\u7684\u9ad8\u5ea6\u8bbe\u4e3a1\u662f\u4e3a\u4e86\u540e\u9762\u7684\u904d\u5386\r\n        \/\/\u628aheader\u6307\u5411\u4e0b\u4e00\u4e2a\u8282\u70b9\uff0c\u4e5f\u5c31\u662fnil\r\n        for(int i = DEFAULT_LEAVEL - 1; i &gt;= 0; i --){\r\n            header.forword[i] = nil;\r\n        }\r\n        current = header;\r\n    }\r\n    \/**\r\n     * \u5c06\u6307\u5b9a\u6570\u7ec4\u8f6c\u6362\u6210\u8df3\u8868\r\n     * @param data\r\n     *\/\r\n    public void addArrayToSkipList(int[] data){\r\n        \/\/\u5148\u5c06data\u6570\u7ec4\u8fdb\u884c\u6392\u5e8f\u6709\u4e24\u79cd\u65b9\u6cd5\uff1a\r\n        \/\/1.\u7528Arrays\u7c7b\u7684sort\u65b9\u6cd5\r\n        \/\/2.\u81ea\u5df1\u5199\u4e00\u4e2a\u5feb\u901f\u6392\u5e8f\u7b97\u6cd5\r\n        quickSort(data);\r\n        \/\/System.out.println( Arrays.toString(data));\r\n        \/\/\r\n        for(int d : data){\r\n            \/\/\u56e0\u4e3a\u6570\u7ec4\u5df2\u7ecf\u6709\u5e8f\r\n            \/\/\u6240\u4ee5\u9009\u62e9\u5c3e\u63d2\u6cd5\r\n            add_tail(d);\r\n        }\r\n    }\r\n    \/**\r\n     * \u5c06\u6307\u5b9a\u6570\u636e\u6dfb\u52a0\u5230\u8df3\u8868\r\n     * @param data\r\n     *\/\r\n    public void add(int data){\r\n        Node preN = find(data);\r\n        if(preN.data != data){ \/\/\u627e\u5230\u76f8\u540c\u7684\u6570\u636e\u7684\u8282\u70b9\u4e0d\u5b58\u5165\u8df3\u8868\r\n            int k = leavel();\r\n            Node node = new Node(data, k);\r\n            \/\/\u627e\u65b0\u8282\u70b9node\u5728\u8df3\u8868\u4e2d\u7684\u6700\u7ec8\u4f4d\u7f6e\u7684\u540e\u4e00\u4e2a\u4f4d\u7f6e\u8282\u70b9\u3002\u6ce8\u610f\u8fd9\u91cc\u7684\u540e\u4e00\u4e2a\u4f4d\u7f6e\u8282\u70b9\u662f\u6307\u5982\u4e0b\uff1a\r\n            \/\/ node1 --&gt; node2  (node1 \u5c31\u662fnode2\u7684\u540e\u4e00\u4e2a\u8282\u70b9)\r\n \r\n            dealForAdd(preN, node, preN.forword[0], k);\r\n        }\r\n    }\r\n    \/**\r\n     * \u5982\u679c\u5b58\u5728 data, \u8fd4\u56de data \u6240\u5728\u7684\u8282\u70b9\uff0c \r\n     * \u5426\u5219\u8fd4\u56de data \u7684\u524d\u9a71\u8282\u70b9 \r\n     * @param data\r\n     * @return\r\n     *\/\r\n    private Node find(int data){\r\n        Node current = header;\r\n        int n = current.forword.length - 1;\r\n \r\n        while(true){  \/\/\u4e3a\u4ec0\u4e48\u8981while(true)\u5199\u4e2a\u6b7b\u5faa\u73af\u5462 \uff1f\r\n            while(n &gt;= 0 &amp;&amp; current.data &lt; data){\r\n                if(current.forword[n].data &lt; data){\r\n                    current = current.forword[n];\r\n                }else if(current.forword[n].data &gt; data){\r\n                    n -= 1;\r\n                }else{\r\n                    return current.forword[n];\r\n                }\r\n            }\r\n            return current;\r\n        }\r\n    }\r\n    \/**\r\n     * \u5220\u9664\u8282\u70b9\r\n     * @param data\r\n     *\/\r\n    public void delete(int data){\r\n        Node del = find(data);\r\n        if(del.data == data){ \/\/\u786e\u5b9a\u627e\u5230\u7684\u8282\u70b9\u4e0d\u662f\u5b83\u7684\u524d\u9a71\u8282\u70b9\r\n            delForDelete(del);\r\n        }\r\n    }\r\n    private void delForDelete(Node node) {\r\n        int h = node.forword.length;\r\n        for(int i = h - 1; i &gt;= 0; i --){\r\n            Node current = header;\r\n            while(current.forword[i] != node){\r\n                current = current.forword[i];\r\n            }\r\n            current.forword[i] = node.forword[i];\r\n        }\r\n        node = null;\r\n    }\r\n    \/**\r\n     * \u94fe\u5c3e\u6dfb\u52a0\r\n     * @param data\r\n     *\/\r\n    public void add_tail(int data) {\r\n        Node preN = find(data);\r\n        if(preN.data != data){\r\n            int k = leavel();\r\n            Node node = new Node(data, k);\r\n             \r\n            dealForAdd(current, node, nil, k);\r\n             \r\n            current = node;\r\n        }\r\n    }\r\n    \/**\r\n     * \u6dfb\u52a0\u8282\u70b9\u662f\u5bf9\u94fe\u8868\u7684\u76f8\u5173\u5904\u7406\r\n     * @param preNode\uff1a\u5f85\u63d2\u8282\u70b9\u524d\u9a71\u8282\u70b9\r\n     * @param node\uff1a\u5f85\u63d2\u8282\u70b9\r\n     * @param succNode\uff1a\u5f85\u63d2\u8282\u70b9\u540e\u7ee7\u8282\u70b9\r\n     * @param k\r\n     *\/\r\n    private void dealForAdd(Node preNode, Node node, Node succNode, int k){ \/\/\u5176\u5b9e\u8fd9\u4e2a\u65b9\u6cd5\u91cc\u7684\u53c2\u6570 k \u6709\u70b9\u591a\u4f59\u3002\r\n        int l = header.forword.length;\r\n        int h = preNode.forword.length;\r\n \r\n        if(k &lt;= h){\/\/\u5982\u679c\u65b0\u6dfb\u52a0\u7684\u8282\u70b9\u9ad8\u5ea6\u4e0d\u9ad8\u4e8e\u76f8\u90bb\u7684\u540e\u4e00\u4e2a\u8282\u70b9\u9ad8\u5ea6\r\n            for(int j = k - 1; j &gt;= 0 ; j --){\r\n                node.forword[j] = preNode.forword[j];\r\n                preNode.forword[j] = node;\r\n            }\r\n        }else{\r\n            \/\/\r\n            if(l &lt; k){ \/\/\u5982\u679cheader\u7684\u9ad8\u5ea6\uff08forward\u7684\u957f\u5ea6\uff09\u6bd4 k \u5c0f\r\n                header.forword = Arrays.copyOf(header.forword, k); \/\/\u6682\u65f6\u5c31\u8fd9\u4e48\u5199\u5427\uff0c\u66f4\u597d\u5730\u5904\u7406\u673a\u5236\u6ca1\u60f3\u5230\r\n                nil.forword = Arrays.copyOf(nil.forword, k);\r\n                for(int i = k - 1; i &gt;= l; i --){\r\n                    header.forword[i] = node;\r\n                    node.forword[i] = nil;\r\n                }\r\n            }\r\n            Node tmp;\r\n            for(int m = l &lt; k ? l - 1 : k - 1; m &gt;= h; m --){\r\n                tmp = header;\r\n                while(tmp.forword[m] != null &amp;&amp; tmp.forword[m] != succNode){\r\n                    tmp = tmp.forword[m];\r\n                }\r\n                node.forword[m] = tmp.forword[m];\r\n                tmp.forword[m] = node;\r\n            }\r\n \r\n            for(int n = h - 1; n &gt;= 0; n --){\r\n                node.forword[n] = preNode.forword[n];\r\n                preNode.forword[n] = node;\r\n            }\r\n        }\r\n    }\r\n    \/**\r\n     * \u968f\u673a\u83b7\u53d6\u9ad8\u5ea6,\uff08\u76f8\u5f53\u4e8e\u629b\u786c\u5e01\u8fde\u7eed\u51fa\u73b0\u6b63\u9762\u7684\u6b21\u6570\uff09\r\n     * @return\r\n     *\/\r\n    private int leavel(){\r\n        int k = 1;\r\n        while(rd.nextInt(2) == 1){\r\n            k ++;\r\n        }\r\n        return k;\r\n    }\r\n \/\/www.xttblog.com\r\n    \/**\r\n     * \u5feb\u901f\u6392\u5e8f\r\n     * @param data\r\n     *\/\r\n    private void quickSort(int[] data){\r\n        quickSortUtil(data, 0, data.length - 1);\r\n    }\r\n    private void quickSortUtil(int[] data, int start, int end){\r\n        if(start &lt; end){\r\n            \/\/\u4ee5\u7b2c\u4e00\u4e2a\u5143\u7d20\u4e3a\u5206\u754c\u7ebf\r\n            int base = data[start];\r\n            int i = start;\r\n            int j = end + 1;\r\n            \/\/\u8be5\u8f6e\u6b21\r\n            while(true){\r\n                \/\/\u4ece\u5de6\u8fb9\u5f00\u59cb\u67e5\u627e\u76f4\u5230\u627e\u5230\u5927\u4e8ebase\u7684\u7d22\u5f15i\r\n                while( i &lt; end &amp;&amp; data[++ i] &lt; base);\r\n                \/\/\u4ece\u53f3\u8fb9\u5f00\u59cb\u67e5\u627e\u76f4\u5230\u627e\u5230\u5c0f\u4e8ebase\u7684\u7d22\u5f15j\r\n                while( j &gt; start &amp;&amp; data[-- j] &gt; base);\r\n                if(i &lt; j){\r\n                    swap(data, i, j);\r\n                }else{\r\n                    break;\r\n                }\r\n            }\r\n            \/\/\u5c06\u5206\u754c\u503c\u4e0e j \u4e92\u6362\u4f4d\u7f6e\u3002\r\n            swap(data, start, j);\r\n            \/\/\u5de6\u9012\u5f52\r\n            quickSortUtil(data, start, j - 1);\r\n            \/\/\u53f3\u9012\u5f52\r\n            quickSortUtil(data, j + 1, end);\r\n        }\r\n    }\r\n    private void swap(int[] data, int i, int j){\r\n        int t = data[i];\r\n        data[i] = data[j];\r\n        data[j] = t;\r\n    }\r\n \/\/www.xttblog.com\r\n    \/\/\u904d\u5386\u8df3\u8868  \u9650\u7b2c\u4e00\u5c42\r\n    public Map&lt;integer, node=&quot;&quot;&gt;&gt; lookUp(){\r\n        Map&lt;integer, node=&quot;&quot;&gt;&gt; map = new HashMap&lt;integer, node=&quot;&quot;&gt;&gt;();\r\n        List&lt;node&gt; nodes;\r\n        for(int i = 0; i &lt; header.forword.length; i ++){\r\n            nodes = new ArrayList&lt;node&gt;();\r\n            for(Node current = header; current != null; current = current.forword[i]){\r\n                nodes.add(current);\r\n            }\r\n            map.put(i,nodes);\r\n        }\r\n        return map;\r\n    }\r\n \/\/www.xttblog.com\r\n    public void show(Map&lt;integer, node=&quot;&quot;&gt;&gt; map){\r\n        for(int i = map.size() - 1; i &gt;= 0; i --){\r\n            List&lt;node&gt; list = map.get(i);\r\n            StringBuffer sb = new StringBuffer(&quot;\u7b2c&quot;+i+&quot;\u5c42:&quot;);\r\n            for(Iterator&lt;node&gt; it = list.iterator(); it.hasNext();){\r\n                sb.append(it.next().toString());\r\n            }\r\n            System.out.println(sb.substring(0,sb.toString().lastIndexOf(&quot;--&gt;&quot;)));\r\n        }\r\n    }\r\n    public static void main(String[] args) {\r\n        SkipList list = new SkipList();\r\n        int[] data = {4, 8, 16, 10, 14};\r\n        list.addArrayToSkipList(data);\r\n        list.add(12);\r\n        list.add(12);\r\n        list.add(18);\r\n        list.show(list.lookUp());\r\n        System.out.println(&quot;\u5728\u672c\u6b21\u8df3\u8868\u4e2d\u67e5\u627e15\u7684\u8282\u70b9\u6216\u524d\u9a71\u8282\u70b9\u4e3a\uff1a&quot; + list.find(15));\r\n        System.out.println(&quot;\u5728\u672c\u6b21\u8df3\u8868\u4e2d\u67e5\u627e12\u7684\u8282\u70b9\u6216\u524d\u9a71\u8282\u70b9\u4e3a\uff1a&quot; + list.find(12) + &quot;\\n&quot;);\r\n        list.delete(12);\r\n        System.out.println(&quot;\u5220\u9664\u8282\u70b9\u503c\u4e3a12\u540e\u7684\u8df3\u8868\u4e3a\uff1a&quot;);\r\n        list.show(list.lookUp());\r\n    }\r\n}<\/pre>\n<p>\n\t\u6d4b\u8bd5\u7ed3\u679c\u5982\u4e0b\uff1a\n<\/p>\n<pre class=\"brush:plain;\">\r\n\u7b2c2\u5c42:[data=-2147483648, height=3] --&gt;[data=2147483647, height=3] \r\n\u7b2c1\u5c42:[data=-2147483648, height=3] --&gt;[data=8, height=2] --&gt;[data=14, height=2] --&gt;[data=16, height=2] --&gt;[data=2147483647, height=3] \r\n\u7b2c0\u5c42:[data=-2147483648, height=3] --&gt;[data=4, height=1] --&gt;[data=8, height=2] --&gt;[data=10, height=1] --&gt;[data=12, height=1] --&gt;[data=14, height=2] --&gt;[data=16, height=2] --&gt;[data=18, height=1] --&gt;[data=2147483647, height=3] \r\n\u5728\u672c\u6b21\u8df3\u8868\u4e2d\u67e5\u627e15\u7684\u8282\u70b9\u6216\u524d\u9a71\u8282\u70b9\u4e3a\uff1a[data=14, height=2] --&gt;\r\n\u5728\u672c\u6b21\u8df3\u8868\u4e2d\u67e5\u627e12\u7684\u8282\u70b9\u6216\u524d\u9a71\u8282\u70b9\u4e3a\uff1a[data=12, height=1] --&gt;\r\n \r\n\u5220\u9664\u8282\u70b9\u503c\u4e3a12\u540e\u7684\u8df3\u8868\u4e3a\uff1a\r\n\u7b2c2\u5c42:[data=-2147483648, height=3] --&gt;[data=2147483647, height=3] \r\n\u7b2c1\u5c42:[data=-2147483648, height=3] --&gt;[data=8, height=2] --&gt;[data=14, height=2] --&gt;[data=16, height=2] --&gt;[data=2147483647, height=3] \r\n\u7b2c0\u5c42:[data=-2147483648, height=3] --&gt;[data=4, height=1] --&gt;[data=8, height=2] --&gt;[data=10, height=1] --&gt;[data=14, height=2] --&gt;[data=16, height=2] --&gt;[data=18, height=1] --&gt;[data=2147483647, height=3]<\/pre>\n<p>\n\t\u4ee5\u4e0a\u5c31\u662f\u76f8\u5173\u7684\u5177\u4f53\u5b9e\u73b0\uff0c\u5982\u679c\u4f60\u6709\u7591\u95ee\uff0c\u6b22\u8fce\u7559\u8a00\u8ba8\u8bba\uff01<\/p>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=2396\">java\u5b9e\u73b0\u8df3\u8868\uff08SkipList\uff09<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u524d\u9762\u7684\u300a\u4ece\u6454\u9e21\u86cb\u95ee\u9898\u8bb2\u8df3\u8868\u7684\u539f\u7406\u300b\u4e2d\uff0c\u6211\u7b80\u5355\u8bf4\u4e86\u4e0b\u8df3\u8868\u7684\u76f8\u5173\u77e5\u8bc6\uff0c\u9650\u4e8e\u7bc7\u5e45\u6ca1\u6709\u5b9e\u73b0\u4ee3\u7801\uff0c\u53ea\u662f\u5217\u4e3e\u4e86\u7b97\u6cd5\u548c\u601d\u8def\u3002 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[69,1592,1591],"class_list":["post-2396","post","type-post","status-publish","format-standard","hentry","category-java","tag-java","tag-skiplist","tag-1591"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2396"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2396\/revisions"}],"predecessor-version":[{"id":2397,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/2396\/revisions\/2397"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}