- 博客(20)
- 资源 (4)
- 收藏
- 关注
原创 Java ExecutorService, FutureTaskd
public static void main(String[] args) { ExecutorService executor = Executors.newFixedThreadPool(10); Future future = executor.submit(new Callable() { @Override public String call()
2016-03-07 22:09:01 318
原创 Java读书笔记(2)
垃圾收集器和内存分配策略 垃圾的回收需要回答三个问题 (1)那些内存是垃圾需要回收? (2)垃圾何时回收? (3)如何回收? 一、垃圾的定义 可以将对象的应用看作是棵树,如果从对象没有到java中的定义的根节点,则可以判断是需要回收的对像。在深入理解jvm中是这样定义的:通过一系列称为“GC Roots”的对象作为起始点,从这些节点
2015-12-14 23:52:22 251
原创 JVM读书笔记
深入理解java 虚拟机读书笔记一、java虚拟机运行时数据区分一般为5种 (1)程序技术器:可以理解为当前线程所执行的字节码行数指示器,感觉和PC中的指 令寄存器类似 (2)虚拟机栈 :描述java方法执行的内存模型,每个方法执行时都会生成栈帧用于存储局部变量表,操作数栈、方法链接等 (3)本地方法栈:和虚拟机栈类似,但是为java虚拟机执行的本地方
2015-12-06 22:23:32 331
原创 编程之美,3.11程序改错, 二分扩展
#include using namespace std;int find1(int *a, int start, int end, int b){//给定一个有序序列a,求任意一个i使得a[i]等于b,不存在返回-1. int mid; while(start<=end){ mid = start + (end-start)/2; if(a[mid]<b){ star
2014-07-22 20:09:46 450
原创 大数减法
/*输入两行字符串正整数,第一行是被减数,第二行是减数,输出第一行减去第二行的结果。 备注:1、两个整数都是正整数,被减数大于减数示例: 输入:1000000000000001 1 输出:1000000000000000 注意大数用char a[] 存储,用%s接收,一位一位的运算。注意a[0]里的正负号 */#include #incl
2014-07-11 19:33:17 383
原创 线索二叉树
二叉树的定义#ifndef TREE#define TREE#include using namespace std;struct TreeNode { char val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) {}};st
2014-06-28 20:30:23 336
原创 编程之美--精确表达浮点数
2. 一问题描述: 使用分数形式来表示小数,有限小数和无限循环小数都可以转化为分数。 例如: 0.9 = 9 / 10 。 0.33333(3) = 1 / 3 。 二问题分析: (1) 若是有限小数,则可以使用以下方法: 0.a1 a2 a3 a4 a5 ..an = a1 a2 a3 a4 a5 a6 an / 10
2014-06-25 22:46:56 393
原创 二叉树非递归遍历
中序遍历vector midorderTraversal(TreeNode *root){ vector temp; stack s; bool left = false; bool right = false; if(root == NULL) return temp; TreeNode* p = root;
2014-06-22 12:18:04 379
原创 01背包问题
#include #include using namespace std;class OneZeroPacket{ public: OneZeroPacket(int wei, int nu, int *vl, int *wl):weight(wei),number(nu) { v
2014-06-19 22:23:01 359
原创 Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".
2014-05-05 09:39:33 443
原创 Evaluate Reverse Polish Notation
class Solution {public: bool valid_operator(const string token){ return(token.compare("+") == 0 || token.compare("-") == 0 || token.compare("*") == 0 || tok
2014-05-05 09:36:19 449
原创 2014年腾讯实习生招聘最后一题
题目来源于:http://blog.chinaunix.net/uid-29038263-id-4198455.html给定n块木板A[1...n],高度记为A[i],每块目标高度不等,宽度相等,用这些木板排列成一面木板墙,木板排列好后,求解木板墙中最大的矩形面积,请设计算法求得木板墙最大的矩形面积,并分析算法效率。举例说明,如下图所示的木板排列,最大矩形面积为深灰色区域,即4*3
2014-04-25 11:16:36 556 1
转载 bonnmotion模型配置命令
Available models:+ GaussMarkov - Gauss-Markov model+ ManhattanGrid - Manhattan Grid model+ RandomWaypoint - Random Waypoint model+ RPGM - Reference Point Group Mobility model+ Static - static net
2014-04-23 16:26:09 1429
原创 MOVE.jar+sumo悲剧的一天
用MOVE时,create Loading configuration... Warning: Please note that 'xml-node-files' is deprecated.Use 'node-files' instead.Warning: Please note that 'xml-edge-files' is deprecated.Use 'edg
2014-04-17 22:50:47 1433 1
转载 struct hdr_cmn
//对ns2中的hdr_cmn头 ,源码进行注解//源码来源于http://www.cs.mun.ca/~yzchen/code/ns-2.33/packet_8h_source.html struct hdr_cmn { enum dir_t { DOWN= -1, NONE= 0, UP= 1 packet_t ptype_; // pack
2014-03-28 22:42:00 787
转载 struct hdr_ip
/Users/yzchen/ns/ns-allinone-2.33/ns-2.33/common/ip.h对一些重要的地方加一些中文注解00037 /* a network layer; basically like IPv6 */00038 #ifndef ns_ip_h00039 #define ns_ip_h00040 00041 #include "config.h"00042
2014-03-28 22:33:52 848
转载 hbase+eclipse 常见问题解决方案
eclipse提示The import org.apache.hadoop.hbase cannot be resolved的解决方法在eclipse中的hbase工程中右击-->properties-->java build path-->libraries-->add external jars-->把hbase-0.90.3.jar add进去运行后得到如下错误
2013-11-22 20:09:25 979
Decentralised Cooperative Agent-based Clustering in ITS
2013-12-02
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人