自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(17)
  • 资源 (3)
  • 收藏
  • 关注

原创 numof1

输入一个int型的正整数,计算出该int型数据在内存中存储时1的个数。C++代码#include<iostream>using namespace std;int main() { int n; int cnt=0; cin>>n; while(n) { n = n & (n-1); cnt++; }

2016-09-24 22:46:10 518

原创 句子反转

将一个英文语句以单词为单位逆序排放。例如“I am a boy”,逆序排放后为“boy a am I” 所有单词之间用一个空格隔开,语句中除了英文字母外,不再包含其他字符 C++代码#include<iostream>#include<stack>#include<string>using namespace std;int main(){ string s; stack

2016-09-24 22:35:36 546

原创 n!末尾的0的个数

分解因子, 当且仅当 因子中出现 一对 (2,5)时, 最后结果会增加一个 trailing zero. 1. 2的个数永远多于5个个数. 2. 计算5的个数时, 最简单的方法是 SUM(N/5^1, N/5^2, N/5^3…)#include<iostream>#include<string>using namespace std;int trailingZeroes(int n)

2016-09-18 20:59:45 469

转载 归并排序实现

归并排序是建立在归并操作上的一种有效的排序算法。该算法是采用分治法(Divide and Conquer)的一个非常典型的应用。首先考虑下如何将将二个有序数列合并。这个非常简单,只要从比较二个数列的第一个数,谁小就先取谁,取了后就在对应数列中删除这个数。然后再进行比较,如果有数列为空,那直接将另一个数列的数据依次取出即可。void MemeryArray(int a[], int n, int b[

2016-09-16 16:49:07 204

转载 直接插入排序分析

直接插入排序(Insertion Sort)的基本思想是:每次将一个待排序的记录,按其关键字大小插入到前面已经排好序的子序列中的适当位置,直到全部记录插入完成为止。设数组为a[0…n-1]。初始时,a[0]自成1个有序区,无序区为a[1..n-1]。令i=1将a[i]并入当前的有序区a[0…i-1]中形成a[0…i]的有序区间。i++并重复第二步直到i==n-1。排序完成。下面给出严格按照定

2016-09-16 11:55:55 292

转载 Ceph分布式存储系统

Ceph是根据加州大学Santa Cruz分校的Sage Weil的博士论文所设计开发的新一代自由软件分布式文件系统,其设计目标是良好的可扩展性(PB级别以上)、高性能及高可靠性。Ceph其命名和UCSC(Ceph 的诞生地)的吉祥物有关,这个吉祥物是“Sammy”,一个香蕉色的蛞蝓,就是头足类中无壳的软体动物。这些有多触角的头足类动物,是对一个分布式文件系统高度并行的形象比喻。 其设计遵循了三个

2016-09-12 01:38:07 7988

原创 数组中小于nums[i]的个数

给定一个数组nums,返回一个计数数组count ,count[i] 表示nums中第i个右边有多少个数小于nums[i].输入为空格隔开的一行整数,至少包含一个数取值为[0,100],如 1,2,3,4 输出为一行,空格隔开,如 0 0 0 0#include<iostream>#include<vector>using namespace std;vector<int> litter(

2016-09-10 15:40:15 827

原创 翻转数组

给定一个长度为n的整数数组a,元素均不相同,问数组是否存在这样一个片段,只将该片段翻转就可以使整个数组升序排列。其中数组片段[l,r]表示序列a[l], a[l+1], …, a[r]。原始数组为 a[1], a[2], …, a[l-2], a[l-1], a[l], a[l+1], …, a[r-1], a[r], a[r+1], a[r+2], …, a[n-1], a[n], 将片段[l

2016-09-10 11:51:26 861

原创 最大子串和

Description Given a sequence a[1],a[2],a[3]……a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5 + 4 = 14. 分析

2016-09-07 21:30:57 483

转载 链表创建,添加,反转等

题目:定义一个函数,输入一个链表的头结点,反转该链表并输出反转后链表的头结点。 假设有链表A->B->C->D->E->F->G。在反转链表过程中的某一阶段,其链表指针指向为:A<-B<-C<-D E->F->G。也就是说在结点D之前的所有结点都已经反转,而结点D后面的结点E开始的所有结点都没有反转。这样D跟E之间存在了断裂。我们如果要实现链表的反转,会有以下几个重要步骤: D->E变为D-

2016-09-07 18:24:14 253

转载 Markdown编辑器使用

本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦:Markdown和扩展Markdown简洁的语法代码块高亮图片链接和图片上传LaTex数学公式UML序列图和流程图离线写博客导入导出Markdown文件丰富的快捷键快捷键加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl + Q插入链接 Ctrl +

2016-09-07 18:18:16 156

原创 [编程题]最长公共子串

对于两个字符串,请设计一个时间复杂度为O(m*n)的算法(这里的m和n为两串的长度),求出两串的最长公共子串的长度。这里的最长公共子串的定义为两个序列U1,U2,..Un和V1,V2,…Vn,其中Ui + 1 == Ui+1,Vi + 1 == Vi+1,同时Ui == Vi。 给定两个字符串A和B,同时给定两串的长度n和m。 测试样例: “1AB2345CD”,9,”12345EF”,7

2016-09-07 10:24:06 374

原创 2. Add Two Numbers

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linke

2016-09-06 16:15:28 211

原创 217. Contains Duplicate

Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false

2016-09-03 11:25:15 200

原创 205. Isomorphic Strings

Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t. All occurrences of a character must be replaced with another cha

2016-09-03 10:26:42 200

原创 172. Factorial Trailing Zeroes

Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 只有2和5相乘才会出现0,其中整十也可以看做是2和5相乘的结果,所以,可以在n之前看看有多少个2以及多少个5就行了,又发现2的数量一定多于或者等于

2016-09-02 22:49:59 189

原创 66. 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. Subscribe to see which comp

2016-09-02 16:57:06 196

区块链基础

Stage I: Terminology and Technical Foundations Stage II: Why the Blockchain Is Needed Stage III: How the Blockchain Works

2017-10-10

区块链指南

密码学基础、区块链、分布式系统、比特币项目、超级账本(Hyperledger)、以太坊(Ethereum)

2017-10-10

密码学课件

张焕国 武汉大写计算机学院 密码学 信息安全数学基础 PKI技术

2013-10-30

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除