- 博客(14)
- 资源 (2)
- 收藏
- 关注
原创 C++ 拷贝构造函数
对于普通类型的对象来说,它们之间的复制是很简单的,例如:int a=88;int b=a; 而类对象与普通对象不同,类对象内部结构一般较为复杂,存在各种成员变量。下面看一个类对象拷贝的简单例子。#include using namespace std;class CExample {private: int a;public: CExample(int b
2016-03-28 16:47:16 303
原创 找出个数超过一般的数
#includeusing namespace std;int findNum(int *number,int length){ int currNum=0; int target; for(int i=0; i<length; i++){ if(currNum==0){ target=number[i]; currNum=1; } else{ if(n
2016-03-28 09:23:20 390
原创 大数相乘
#include#includeusing namespace std;void multiply(const char* a, const char* b){ int aLen = strlen(a); int bLen = strlen(b); int *result = new int[aLen+bLen]; for(int i=0; i<(aLen+bLen); i++
2016-03-27 20:52:48 303
原创 Symmetric encryption principles
Symmetric encryption principlesSecurity depends on the secrecy of the key, not thealgorithmA good algorithm is a good trade-off between security and efficiencyStream ciphersStream
2016-03-15 20:41:25 819
原创 Mathematical Foundations
Modulo operationthere are two unique integers q and r such that a = qb + r,where q = a/b , and 0 ≤ r We write r = a mod b.--- Example: 89 mod 7 = 5 and -13 mod 6 = 5Set of residues: Zn
2016-03-15 19:19:32 576
原创 Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.struct ListNode { int val; ListNode *next; ListN
2016-03-14 10:48:24 268
原创 Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with
2016-03-14 10:45:42 282
原创 Valid Parentheses
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all va
2016-03-12 18:50:44 313
原创 Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the
2016-03-12 18:06:07 380
原创 一个整型数组里除了两个数字之外,其它数字都出现了两次。找出这两个数字
一个整型数组里除了两个数字之外,其它数字都出现了两次。找出这两个数字。时间复杂度O(n),空间复杂度O(1)1.从头到尾异或数组里面的每一个数字,得到两个数字异或的结果。2.找到异或结果数第一个不为0的位3.将数组分为两类,一类就是这一位为1,另一位就是这一位是0的,分别异或得到的结果就是只出现一次的两个数字。#includeusing namespace std;unsi
2016-03-08 12:26:29 995
原创 字符串中的单词逆转
#includeusing namespace std;void Reverse(char *pb, char *pe){ if(pb==NULL || pe==NULL) return; while(pb<pe){ char tmp=*pb;; *pb=*pe; *pe=tmp; pb++;pe--; } }char* ReverseSentenc
2016-03-06 11:45:54 510
原创 大数相乘
#include#includeusing namespace std;void multiply(const char* a, const char* b){ int aLen = strlen(a); int bLen = strlen(b); int *result = new int[aLen+bLen]; for(int i=0; i<(aLen+bLen); i++)
2016-03-06 10:23:33 267
原创 Reverse Integer
Example1: x = 123, return 321Example2: x = -123, return -321click to show spoilers.Have you thought about this?Here are some good questions to ask before coding. Bonus points for you if yo
2016-03-03 10:20:15 284
原创 安全的目标
Confidentiality(机密性)what?(只有授权的人才能获取数据)1.Data in transmission or stored in a storage system could be very sensitive and only authorized people are allowed to read.2. Keeping data confidentiality
2016-03-01 11:22:47 367
MATLAB7_0基础教程_清华大学.pdf
2015-01-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人