track操作类似与插入操作。rank操作返回比当前元素小或者相等的元素数。思路:track操作插入构造BST(没有保证平衡),但是节点增加一个leftSize,这里学习一下。public class Solution { private static RankNode root = null...
分类:
其他好文 时间:
2014-08-24 17:52:52
阅读次数:
212
可见性:
我们希望确保一个线程修改了对象的状态后,其他线程能够看到发生的状态变化。
例:在没有同步的情况下共享变量
public class NoVisibility {
private static boolean ready;
private static int number;
public static class Rea...
分类:
编程语言 时间:
2014-08-24 15:31:02
阅读次数:
190
using System; namespace FuncDemo { internal class Program { private static void Main() { ...
分类:
其他好文 时间:
2014-08-24 15:18:52
阅读次数:
219
/// /// 冒泡法排序 /// /// private static void MySort(int[] shuzu) { //比较多少轮 for (int i = 0; i ...
分类:
其他好文 时间:
2014-08-23 21:32:51
阅读次数:
216
1 public class NoVisibility{ 2 private static boolean ready; 3 private static int number; 4 private static class ReaderThread extends Thread...
分类:
编程语言 时间:
2014-08-23 11:06:50
阅读次数:
302
接着上一篇继续学习多线程。 死锁(DeadLock) 当多线程共享资源时,各占一部分资源,而又在等待对方释放资源,这样的情况我们称为死锁。下面通过一个生动的程序来理解死锁。 class Program { private static object knife = new object(); //临...
分类:
编程语言 时间:
2014-08-22 20:55:59
阅读次数:
250
package algorithm;
public class SortAll {
public static void main(String[] args) {
char buf[] = {'1','2','3','4','5'};
perm(buf,0,buf.length-1);
}
private static void perm(char[] buf, int sta...
分类:
编程语言 时间:
2014-08-22 17:56:39
阅读次数:
233
java定时任务,每天定时执行任务。 public class TimerManager { //时间间隔 private static final long PERIOD_DAY = 24 * 60 * 60 * 1000; public TimerManager() { Calenda...
分类:
编程语言 时间:
2014-08-22 10:39:56
阅读次数:
214
一、敏感词屏蔽的方法:
public static String filterFile="" +
"你妈|" +
"靠|" +
"傻B|" +
"傻逼|" +
"最后一个不会被屏蔽";
private static final String FILTER_WORD = filterFile.replaceAll("\r\n", "");
public static bool...
分类:
其他好文 时间:
2014-08-21 17:15:18
阅读次数:
190
[DllImport("user32")]private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);//下面是可用的常量,根据不同的动画效果声明自己需要的private const int AW_HO...