- 博客(86)
- 资源 (10)
- 收藏
- 关注
原创 linux free命令用法以及解释
free -mt total used free shared buffers cachedMem: 16084 11115 4968 0 40 7311-/+ buffers/cache: 3764 12320Sw
2015-09-13 13:13:25
2252
原创 php 中利用json_encode和json_decode传递包含特殊字符的数据
$json2 = json_decode($json, true);//echo "json2:";//var_dump($json2);json_encode string json_encode ( mixed $value [, int $options = 0 ] )返回 value 值的 JSON 形式json_decodemixed json_decode (
2015-07-12 11:38:01
6257
原创 gem5 设置checkpiont以及从checkpoint处开始执行
以spec2006中的bzip2为例说明,如何设置checkpoint ,以及从checkpoint处开始继续执行。这样做的目的是,可以采用automic的方式执行N条指令,然后以detailed的方式执行M条指令。1.设置checkpoint:在第5000000条instruction处设置checkpoint./build/ALPHA_SE/gem5.opt -d ./
2015-03-17 12:35:15
4026
原创 关于gem5预取实验时的一些注意事项
1. 不同版本的gem5开启prefetch的方法可能不同,较新的版本需要在gem5/configs/common/Caches.py的class L2Cache(BaseCache)或者class L1Cache(BaseCache)添加相应的prefetcherclass L2Cache(BaseCache): assoc = 8 block_size = 64
2015-01-28 10:35:49
7545
原创 Gem5下同时模拟多个benchmark
仅模拟一个benchmark的脚本# Copyright (c) 2006-2008 The Regents of The University of Michigan# All rights reserved.## Redistribution and use in source and binary forms, with or without# modification, are
2014-11-07 10:52:18
3470
原创 Leetcode Path Sum
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */ /** * http
2014-10-07 22:49:33
1237
原创 Leetcode Best Time to Buy and Sell Stock III
/*** 题目:https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/* Say you have an array for which the ith element is the price of a given stock on day i.* Design an algorithm to find t
2014-10-07 09:44:23
1070
原创 Leetcode Best Time to Buy and Sell Stock II
/** * Say you have an array for which the ith element is the price of a given stock on day i. * Design an algorithm to find the maximum profit. You may complete as many transactions as you like *
2014-10-07 08:54:39
1432
原创 Leetcode Best Time to Buy and Sell Stock
/*** https://oj.leetcode.com/problems/best-time-to-buy-and-sell-stock/* Say you have an array for which the ith element is the price of a given stock on day i.* If you were only permitted to comple
2014-10-06 21:41:17
1063
原创 Surrounded Regions
/** * https://oj.leetcode.com/problems/surrounded-regions/ * 从四个边界的'O'出发,它们所能到达的'O'就是没有被包围的'O'。 * 所以,该题可以用BFS遍历或者DFS遍历。*/class Solution {public: void solve(vector> &board) { int row
2014-10-06 20:47:25
996
原创 Leetcode Longest Common Prefix
/** *https://oj.leetcode.com/problems/longest-common-prefix * Write a function to find the longest common prefix string amongst an array of strings. * 问题描述:写一个函数找到一组字符串的最长公共前缀。 * 这个题要明确一个观点,一组
2014-10-06 13:22:43
1053
原创 Leetcode Plus One
//Given a non-negative number represented as an array of digits, plus one to the number.//The digits are stored such that the most significant digit is at the head of the list.//digits={9,9,9,
2014-10-06 12:27:04
1145
原创 Leetcode Symmetric Tree
非递归解法/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class
2014-10-06 09:59:02
1241
原创 Leetcode Pascal's Triangle II
class Solution {public: vector getRow(int rowIndex) { vector result; int i = 0; int j = 0; if(rowIndex < 0) { return result; } result.
2014-10-05 22:04:47
976
原创 Leetcode Pascal's Triangle
class Solution {public: vector > generate(int numRows) { vector > result; vector innerResult; int i = 0; int j = 0; for(i = 0; i < numRows; i++){
2014-10-05 21:23:35
896
原创 Leetcode Triangle
/*意思就是:给定一个三角形,求得和最小的路径。每层只能选一个整数,上一层和下一层的整数必须是相邻的。思路:1,动态规划。到第i层的第k个顶点的最小路径长度表示为f(i,k),则f(i, k) = min{f(i-1,k), f(i-1,k-1)} + d(i, k); 其中d(i, k)表示原来三角形数组里 的第i行第k列的元素。则可以求得从第一行到最终到第length-1行第
2014-10-05 20:29:10
903
原创 Leetcode Remove Duplicates from Sorted Array
class Solution {public: int removeDuplicates(int A[], int n) { int duplicate = 0; int i = 0; for(i = 0; i < n - 1; i++){ if(A[i] == A[i + 1]){ dupli
2014-10-05 20:28:56
959
原创 Leetcode Two Sum
struct Node{ int index; int value;};bool compare(Node a, Node b){ return a.value < b.value;}class Solution {public: vector twoSum(vector &numbers, int target) {
2014-10-05 20:26:34
927
原创 042_翻转单词顺序
/**Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without u
2014-10-04 15:41:38
997
原创 Leetcode Binary Tree Preorder Traversal
/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val(x), left(NULL), right(NULL) {} * }; */class Soluti
2014-10-04 14:15:57
1210
原创 Leetcode Linked List Cycle
/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: bool hasCycl
2014-10-04 13:42:14
845
原创 Leetcode Single Number II
/**Given an array of integers, every element appears three times except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without u
2014-10-04 13:20:53
853
原创 057_删除聊表中的重复的节点
#include #include using namespace std;typedef struct ListNode { int data; struct ListNode * next; ListNode(int d) : data(d), next(NULL){}};ListNode *initList(int *array, unsigned int lengt
2014-09-13 22:32:28
847
原创 031_连续子数组的最大和
#include #include using namespace std;bool isValid = true;int FindGreatestSumOfSubArray(int *data, int length) { isValid = true; if (data == NULL || length == 0) { isValid = false; return
2014-09-07 16:54:38
730
原创 017_合并两个排序的链表
#include #include using namespace std;typedef struct ListNode { int data; struct ListNode * next; ListNode(int d) : data(d), next(NULL){}};ListNode *initList(int *array, unsigned int lengt
2014-09-06 22:05:29
798
原创 11_数值的整数次方
#includeusing namespace std;bool isValid = true;bool isPositive = true;bool doubleEqual(double number1, double number2) { if(number1 - number2 -0.0000001) { return true; } else { return
2014-09-06 15:59:54
600
原创 10_二进制中1的个数
#includeusing namespace std;int main() { unsigned int number = 9; cout<<"number:"<<number<<endl; int count_one = 0; while(number) { count_one++; number = number & (number - 1); }
2014-09-06 14:50:44
540
原创 09_斐波那契数列
#include#include#include using namespace std;long long fibRecursion(unsigned n) { if(n <= 0) { return 0LL; } if(n == 1) { return 1LL; } if(n >= 2) { return fibRecursion(n - 1) +
2014-09-06 14:22:38
903
原创 05_从尾到头打印链表
#include #include using namespace std;typedef struct ListNode { int data; struct ListNode * next; ListNode(int d) : data(d), next(NULL){}};ListNode *initList() { ListNode * head = NULL;
2014-09-06 13:22:02
1169
原创 剑指offer_02_二维数组中的查找
#include using namespace std;bool ifHasNum(int *data,int row, int col, int num){ if(data == NULL || row <= 0 || col <= 0){ return false; } int i = 0; int j = col - 1; while(i = 0){ if(nu
2014-09-06 10:34:20
800
原创 采集元数据的C++实现
我要做的是提取Test_case的名字,以及Test_case的持续时间(单位秒):下面是一段示例元数据Start| 20140618 root (6033) | tpi 1.4 | 14:53:52 10050943579848 0 |Start| 20814 SunOS 5.11 11.2 i86pc tcx4440-01 |STF_ENV| STC_NAME = os-zones |
2014-09-06 09:45:16
2087
原创 Leetcode Add two numbers
/*#include using namespace std; *//** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */cla
2014-08-22 18:50:25
740
转载 贪心算法 解决 活动选择问题
#define GREEDY_RECURIVE#ifdef GREEDY_RECURIVE#include #include #include using namespace std;void recursive_activity_selector( const int started[], const int finished[],vector& result, int i,in
2014-08-02 17:10:33
809
转载 c++_学习路线与推荐书籍(软件工程师)
转载地址(一)语言入门:《C++ Primer》最新版本:第三版(第四版国外已上架,国内一些网上书店也在预订中)适合有丰富C经验,缺乏C++经验的。不过我个人一直认为此书带着过于强烈的C语言的痕迹,对于C++的学习未必是好事。《The C++ Programming Language》/《C++程序设计语言
2014-04-28 10:26:09
1782
原创 二分查找
#include //LENGTH 为有序表长度 #define LENGTH 6 //int binarySearch(int a[], int value, int len){ int low = 0; int high = len - 1; int mid = 0; while(low <= high){ mid = low + (high - low) / 2;
2014-04-13 21:20:06
729
原创 微软实习生第一题
/*时间限制:10000ms单点时限:1000ms内存限制:256MBFor this question, your program is required to process an input string containing only ASCII characters between ‘0’ and ‘9’, or between ‘a’ and ‘z’ (including
2014-04-13 13:36:10
949
2
原创 一个简单的数据收集程序
#include #include#define BufferLength 500#define NUM_BENCHMARKS 10int isBufferContainsStr(char buffer[], char str[], int n) { int isContains=0; int i = 0; int j = 0; int k = 0; for(i=0; i
2014-03-20 11:42:27
1975
1
原创 关于spec2006的调研
以下表格为spec2006的简单介绍,分别benchmark的语言,benchmark指令数(单位billion),benchmark指令中,分支执行,load,store指令比例(所占百分比)Name – LanguageInst. Count(Billion)Branches %Loads %Stores %C
2014-03-14 13:03:14
2703
转载 十分钟掌握diff&patch用法(转)
原博客地址:http://hi.baidu.com/thinkinginlamp/item/0ba1d051319b5ac09e2667f8作为程序员,了解diff&patch命令是非常必要的。比如说我们发现某个项目有bug代码,而自己又没有svn的提交权限,那么此时最合适的解决方法就是用diff命令做一个补丁发给项目成员。项目成员通过patch命令可以立刻知道你的意图。有人会说直接传一个新文
2014-03-12 10:48:51
946
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人