摘要: 在Arrays.java中的sort中 public static void sort(Object[] a, int fromIndex, int toIndex) { if (LegacyMergeSort.userRequested) legacyMergeSort(a, fromIndex, toIndex); else ComparableTimSort.sort(a, fromIndex, toIndex); } /** To be removed in a future rel... 阅读全文
posted @ 2012-11-02 17:19 zhwj184 阅读(240) 评论(0) 推荐(0) 编辑
摘要: /* * Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * publishe... 阅读全文
posted @ 2012-11-02 14:35 zhwj184 阅读(241) 评论(0) 推荐(0) 编辑
摘要: 在java中可能很多人都会忽略数据结构(类似树,跳跃表等),大家都比较熟悉链表,数组,栈,队列,哈希表等。最近看了jdk中关于树和跳跃表等的实现,其实数据结构真的是基础,有兴趣的java程序员可以翻开jdk的代码仔细阅读下面几种数据结构的学习。TreeMap:红黑树http://v.163.com/movie/2010/12/9/J/M6UTT5U0I_M6V2TJ49J.html这里有网易公开课的教学视频PriorityQueue:最小堆比较简单的一种实现,queue[n]的左右儿子是queue[2*n+1]和queue[2*n+2],每次根据排序类取第一个queue[0],然后把queue 阅读全文
posted @ 2012-11-02 14:10 zhwj184 阅读(334) 评论(0) 推荐(0) 编辑