自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

第七夜的雪

一路走过

  • 博客(34)
  • 资源 (5)
  • 收藏
  • 关注

原创 《算法分析与设计》Week 19

287. Find the Duplicate NumberDescription:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must e

2017-06-04 20:23:33 381

原创 《算法分析与设计》Week 18

155. Min StackDescription:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes t

2017-06-04 18:26:10 355

原创 《算法分析与设计》Week 17

367. Valid Perfect SquareDescription:Given a positive integer num, write a function which returns True if num is a perfect square else False.Note: Do not use any built-in libra

2017-06-04 18:01:58 414

原创 《算法分析与设计》Week 16

62. Unique PathsDescription:A robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point

2017-06-04 17:18:49 363

原创 《算法分析与设计》Week 15

238. Product of Array Except SelfDescription:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of

2017-06-04 16:56:37 351

原创 《算法分析与设计》Week 14

2. Add Two NumbersDescription:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain

2017-06-04 16:13:13 360

原创 《算法分析与设计》Week 13

145. Binary Tree Postorder TraversalDescription:Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \

2017-06-04 16:02:09 358

原创 《算法分析与设计》Week 12

50. Pow(x, n)Description:implement pow(x, n).Solution:一、题意理解     题意很简单,就是自己实现一个幂函数pow(x,n),即计算x的n次方。这里x是浮点型,n是整型。二、分析     1、幂次是整型的情况下,可以分为两种情况,一种n是负数,一种n是非负

2017-06-04 15:41:56 424

原创 《算法分析与设计》Week 11

116. Populating Next Right Pointers in Each NodeDescription:Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next;

2017-06-02 21:43:29 313

原创 《算法分析与设计》Week 10

74. Search a 2D MatrixDescription:Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:Integers in each row are sor

2017-06-02 21:26:46 315

原创 《算法分析与设计》Week 9

84. Largest Rectangle in HistogramDescription:Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle i

2017-04-20 21:51:09 342

原创 《算法分析与设计》Week 8

96. Unique Binary Search TreesDescription:Given n, how many structurally unique BST's (binary search trees) that store values 1...n?For example,Given n = 3, there are a total of 5

2017-04-19 21:58:38 464

原创 《算法分析与设计》Week 7

338. Counting BitsDescription:Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and retur

2017-04-07 17:41:57 334

原创 《算法分析与设计》Week 6

455. Assign CookiesDescription:Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed fa

2017-03-31 16:55:25 439

原创 《算法分析与设计》Week 5

513. Find Bottom Left Tree ValueDescription:Given a binary tree, find the leftmost value in the last row of the tree.Example 1:Input: 2 / \ 1 3Output:1Exa

2017-03-30 11:31:52 478

原创 《算法分析与设计》Week 4

310. Minimum Height TreesDescription:For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible root

2017-03-29 22:14:19 490

原创 《算法分析与设计》Week 3

148. Sort ListDescription:Sort a linked list in O(n log n) time using constant space complexity.Solution:一、题意理解     给链表排序,要求O(nlogn)时间复杂度和O(1)的空间复杂度二、分析     1、对链表

2017-03-25 22:01:27 271

原创 《算法分析与设计》Week 2

152. Maximum Product SubarrayDescription:Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-

2017-03-05 20:29:26 370

原创 《算法分析与设计》Week 1

442. Find All Duplicates in an ArrayDescription:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once.Find all the elements th

2017-02-25 21:58:46 305

原创 Huffman压缩真正的C++实现

关于Huffman编码的规则不多说了。   首先谈一下用C++实现Huffman 压缩 的过程。   (1)进行字符频数统计,读文件一般按字节读入,每个字节是8bit,可以开一个比2^8 = 256大一些的数组,如freq[260] = {0},然后每读入一个字符,对应的freq[index]++即可。   (2)根据统计结果构造Huffman树。可以选择二叉树,也可以选择数组存储Huffma

2016-10-17 23:26:02 13972 5

原创 堆排序C++实现

堆排序过程假设要求从小到大排序对序列a[n]1、建立初始大顶堆。2、输出堆顶元素,即交换a[0]和a[n-1],此时a[n-1]是最大的元素。有序区为[n-1, n-1],无序区为[0,n-2]。3、无序区堆结构被破坏,重新调整后再输出对顶元素。4、重复2~3,直到无序区只有1个元素。附简单的C++代码#include #include using

2016-09-19 21:28:31 398

转载 iOS进阶面试题----经典10道

OneV‘s Den在博客里出了10道iOS面试题,用他的话是:"列出了十个应聘Leader级别的高级Cocoa/CocoaTouch开发工程师所应该掌握和理解的技术" 。 在这里給一份我的答案。  1. 你使用过Objective-C的运行时编程(Runtime Programming)么?如果使用过,你用它做了什么?你还能记得你所使用的相关的头文件或者某些方法的名称吗?  Ob

2015-04-12 15:51:39 674

转载 转 mac下autoconf automake安装

curl -O http://mirrors.kernel.org/gnu/m4/m4-1.4.13.tar.gztar -xzvf m4-1.4.13.tar.gzcd m4-1.4.13./configure –prefix=/usr/localmakesudo make installcd ..curl -O http://mirrors.kernel.o

2015-01-16 18:22:38 629

原创 DES密码算法

DES算法

2014-11-03 21:49:32 1155

原创 rsync与cwRsync

!Attention:这里的rsync是3.1.0,协议版本是31。cwrsync是3.0.6,协议版本是30.二者可以正常通信,亲测!Rsync For Linux:1、下载 rsync 3.1.0。打开终端:wget -c ftp://ftp.samba.org/pub/rsync/rsync-3.1.0.tar.gz如果这个ftp关了,可以上我的资源下

2014-10-29 22:15:26 1863

原创 Sicily 1239.Smallest Differencev

注:思路分析来源于ID为jasison的博主http://blog.csdn.net/jasison/article/details/8477279,代码也是模仿而写,稍有优化。(请支持正版原创)题意:给定n(2 比如,0 1 2 4 6 7,构成176 和 204 能使差最小为28。思路:贪心。分情况讨论。1)是有奇数个数的话,那么,选择非零的最小的数字作为较大数的最高位

2013-04-19 14:40:32 717

原创 如何在函数中判断传递的对象指向的是哪个类

Three classes A, B and C are shown below:class A {public:virtual ~A() {};};class B: public A {};class C: public B {};You are to implement a function string verify(A *), such that it return

2013-04-18 18:32:49 670

原创 Sicily 1085.Longge's problem

几道比赛题都是数论题,不会做,只好上网搜,然后自己整理一下。一些解题方法非本人原创。题目大意:求∑gcd(i,N),1分析:然后根据上式,从小到大对N的质因数进行相应操作,注意一些细节即可。。分析好麻烦,数学题吗擦。。。#includeint main(){ long long n,i,x; wh

2013-04-17 18:28:05 570

原创 Sicily 1199.GCD

几道比赛题都是数论题,不会做,只好上网搜,然后自己整理一下。一些解题方法非本人原创。题目大意:给定N,M,求有多少X=M方法:(1)欧拉函数。。。这里不再赘述,可以百度。(2)变形技巧。分析:       要求L=gcd(N,X)>=M,则L是N的一个因子。可以先求出N的所有因子,将其中大于或等于M的数用数组L[]储存起来。而对于每一个不同的L[i],它所对应的X肯定不一样

2013-04-16 15:20:47 710

原创 Sicily 2501.算算式

几道比赛题都是数论题,不会做,只好上网搜,然后自己整理一下。一些解题方法非本人原创。 不用试,朴素法肯定超时。做这种题还是先学点儿数论吧。。。(1)要计算只包含加法、减法和乘法的整数表达式除以正整数n的余数,可以在每步计算之后对n取余,结果不变。(2)费马小定理:假如p是质数,且gcd(a,p)=1(即a,p互质),那么 注意到9901是质数(肯定要是了,不然1s完

2013-04-16 14:14:22 1109

原创 Sicily 1027. MJ, Nowhere to Hide

1027. MJ, Nowhere to Hide     写了比较长的代码,不过竟然一遍就Accept,甚慰吾心。312KB的运存是我水平的极限了,还好n按字母排序。#include#include#includeusing namespace std;struct ID{ string id; string IP;};struct newID{

2013-03-28 22:58:10 527

原创 UESTC 1143.CD Making

1143.CD MakingDescriptionTom has N songs and he would like to record them into CDs. A single CD can contain at mostK songs. In addition, Tom is very superstitious and he believes the number '1

2013-03-26 18:44:46 815

原创 Sicily 1154. Easy sort

Sicily 1154. Easy sort         看了一会儿,原来是个水题,难道是要自己写个排序算法?。。。不过既然有sort函数,还是直接上吧。。。#include#includeusing namespace std;int main(){ int T; cin>>T; while(T--) { int n;

2013-03-25 12:50:01 1172

原创 Sicily 1000. A-B

Sicily 1000. A-B我去,第一次刷题,原来要输出空格,坑死个爹了。。。#include using namespace std;int main(){ int a,b; cin >>a>>b; cout <<a-b<<endl; return 0;} 西西里处女作,仅以纪念。。。

2013-03-25 12:41:22 824

毛文波:现代密码学理论与实践.pdf

毛文波的《现代密码学理论与实践》的书,不错的一本书

2016-12-29

海关行邮税表mysql插入

海关行邮税表,sql导入,我一行一行的写的。

2014-11-05

rsync-3.1.0

Linux 的一款文件同步工具。 version 3.1.0 protocol version 31

2014-10-29

cwRsync-3.0.6

Windows下用的cwRsync。 vsrsion 3.0.6 protocol version 30。 两端同步时,最好协议版本相同,顶多差两个版本,不然同步会出错

2014-10-29

《C++程序设计》 美 Y.Daniel Liang (梁勇) 习题答案

《C++程序设计》 美 Y.Daniel Liang (梁勇) 的课后Programing Exercise部分的答案,比较全

2013-04-18

空空如也

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

TA关注的人

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