自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(40)
  • 收藏
  • 关注

原创 东北大学考研线性表相关历年真题题目整理

设指针la指向单链表的首结点:编写算法,从表la中删除第i个元素起共len个元素

2014-12-04 01:43:20 3007

原创 东北大学考研二叉树相关试题

设t为一颗二叉树的根节点地址指针,设计一个非递归的算法把二叉树中每个节点的左右孩子位置交换

2014-11-25 00:15:27 3592 1

转载 红黑树

http://baike.baidu.com/view/133754.htm?fr=aladdin

2014-09-17 20:24:14 487

转载 寻找包含给定字符集合的最小子串

#include #include using namespace std;string min_str(string str1,string str2){ if(str1.size() == str2.size() ) { return min(str1,str2); } return str1.size() > str2.size()

2014-09-17 17:35:46 728

转载 const

http://blog.csdn.net/Eric_Jo/article/details/4138548

2014-09-16 22:57:45 400

转载 1NF 2NF 3NF

摘自百度百科http://baike.baidu.com/view/998488.htm?fr=aladdin

2014-09-15 20:57:12 514

转载 TCP三次握手及四次挥手

http://www.cnblogs.com/hnrainll/archive/2011/10/14/2212415.html

2014-09-15 18:05:17 395

原创 【面试准备】八皇后问题

#include using namespace std;#define Slove_num 8int seat[Slove_num];bool ok(int n);int count = 0;void queen(int n){ if(n == Slove_num){ for(int i = 0;i < n; ++i){ cout<<"("<<i<<","<<seat

2014-09-04 16:12:15 439

原创 找出数组中只出现一次的2个数

1. 首先数组中所有元素依次异或,因为相同的元素异或得到0,所以最终的答案就等于那2个唯一的元素a^b的值。2. 因为a,b不同,所以异或得到的答案肯定是不等于0的,那么我们就找到a^b的二进制表示中第一个为1的位,假如是第k位。而a,b两个数在第k位上是不同的,一个为0,一个为13. 接下来我们将第k位是1的分成一组,第k位是0的分成一组,如果2个元素相同,那么他们第k位肯定是一

2014-09-03 16:01:02 374

原创 【面试准备】letcode-Single Number

一个与本身异或之后为0;

2014-09-03 15:44:17 445

原创 【面试准备】letcode-Copy List with Random Pointer

/** * Definition for singly-linked list with a random pointer. * struct RandomListNode { * int label; * RandomListNode *next, *random; * RandomListNode(int x) : label(x), next(NULL),

2014-09-03 15:34:47 403

原创 【面试准备】letcode-Word Break

Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"

2014-09-03 10:19:24 575

原创 【面试准备】letcode-Tow Sum

Given an array of integers, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numbers such that they add up to the target, whe

2014-09-03 09:13:02 520

原创 【面试准备】letcode-Linked List Cycle |

/** * Definition for singly-linked list. * struct ListNode { *     int val; *     ListNode *next; *     ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public:    bo

2014-09-02 21:47:34 399

原创 【面试准备】letcode-Linked List Cycle ||

快慢指针遍历/** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */class Solution {public: List

2014-09-02 21:40:27 393

原创 【面试准备】letcode-Reorder List

Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For example,Given {1,2,3,4}, reorder it to 

2014-09-02 20:39:02 455

原创 【面试准备】letcode-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-09-02 19:41:34 407

原创 【面试准备】letcode-Binary Tree Postorder Traversal

后序遍历二叉树,堆栈,记录一下当前输出的节点;

2014-09-02 19:06:23 425

原创 【面试准备】vector

http://blog.csdn.net/phoebin/article/details/3864590

2014-09-02 18:50:50 372

原创 【面试准备】letcode—LRU

#include #include #include using namespace std;struct CacheNode{ int key; int value; CacheNode(int x,int y):key(x),value(y){}};class LRUCache{public: LRUCache(int capacity){ size = capa

2014-09-02 18:36:57 413

转载 【面试准备】list

STL中list的使用:STL中的list就是一双向链表,可高效地进行插入删除元素。现总结一下它的操作。文中所用到两个list对象c1,c2分别有元素c1(10,20,30)  c2(40,50,60)。还有一个list::iterator citer用来指向c1或c2元素。list对象的声明构造():A.      listc0;                 

2014-09-02 18:03:12 583

原创 【面试准备】letcode-Insertion Sort List

Sort a linked list using insertion sort./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */

2014-09-02 16:41:15 513

原创 【面试准备】letcode—sort list

Sort a linked list in O(n log n) time using constant space complexity./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int

2014-09-02 16:16:57 389

原创 【面试准备】letcode—Max Points on a Line

Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.#include #include #include using namespace std;struct Point{ int x; int y; Point(): x(0),

2014-09-02 14:50:47 382

转载 【面试准备】map

Map是c++的一个标准容器,她提供了很好一对一的关系,在一些程序中建立一个map可以起到事半功倍的效果,总结了一些map基本简单实用的操作!1. map最基本的构造函数;   mapmapstring;         mapmapint;   mapmapstring;         mapmapchar;   mapmapchar;            mapmapint

2014-09-02 14:24:04 346

原创 【面试准备】letcode-Evaluate Reverse Polish Notation

Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ["4", "13", "5", "/", "+"] -> (4 + (13

2014-09-02 11:00:58 390

原创 【面试准备】字符串反序

#include #include #include using namespace std;void reverseWords(string &s) { string a[s.length()]; int j = 0; int aa = 0; int i = 0; char *w = (char*) ma

2014-09-02 09:37:34 428

原创 【面试准备】求字符串中最长的重复子串

#include #include using namespace std;void substr(char *a) //统计数组a中重复出现的最长的子序列 { int n; for (n = 0; a[n] != '\0'; ++n) ; int count = 1; for (int len = n - 1; len > 0; --len) //len:子串的长度

2014-09-02 08:30:29 451

原创 【面试准备】堆排

#include using namespace std;void AdjastHeapSort(int a[],int i,int n){//调整节点i,数组共有n个节点 if(n == 1||i >(n-2)/2){ return ; } int iLeft = 2*i+1;//i从0开始 int iRight = 2*i+2; if(iRight<=n-1){ if

2014-09-01 22:04:49 456

原创 【面试准备】快排

#include using namespace std;void Quicksort(int e[],int first,int end){ int i = first, j = end; int temp = e[i]; while(i<j){ while(i<j && temp<=e[j]){ j--; } e[i] = e[j]; while(i<j &

2014-09-01 19:57:08 405

原创 【面试准备】最长公共子序列

#include #include using namespace std;#define MAXLEN 100void LCSLength(char* x, char *y, int m, int n, int c[][MAXLEN], int b[][MAXLEN]) {//c[][]记录x[i]与y[i]的LCS长度;b[][]记录c[i][j]是通过哪一个子问题的值求得的以决

2014-09-01 19:06:59 351

原创 面试准备——最长公共子串

#include #include using namespace std;string Get_length(string& s,string& t){ int p = s.length(); int q = t.length(); string **num = new string *[p]; for(int i = 0 ; i < p ; ++i)

2014-09-01 09:38:05 367

原创 【面试准备】数据结构-Huffman树

#include using namespace std;//Hanfuman树节点类templateclass HuffmanNode {private: HuffmanNode *left, *right; T data; int weight;public: HuffmanNode() { ; } HuffmanNode(HuffmanNode* L, Huff

2014-08-05 14:53:15 501

原创 【面试准备】数据结构—树

左孩子,右兄弟,二叉树存储-0-

2014-08-05 09:29:28 436

原创 【面试准备】C语言printf输出格式

%a       浮点数、十六进制数字和p-记数法(C99)%A    浮点数、十六进制数字和p-记法(C99)%c    一个字符 %d    有符号十进制整数 %e    浮点数、e-记数法%E    浮点数、E-记数法%f    浮点数、十进制记数法  %g    根据数值不同自动选择%f或%e.%G    根据数值不同自动选择%f或%e.%i      

2014-08-02 19:29:21 402

转载 【面试准备】C文件操作函数

C语言文件操作函数大全clearerr(清除文件流的错误旗标)相关函数 feof表头文件 #include定义函数 void clearerr(FILE * stream);函数说明 clearerr()清除参数stream指定的文件流所使用的错误旗标。返回值 fclose(关闭文件)相关函数 close,fflush,fopen,setbuf表头文件 #i

2014-08-02 19:27:04 425

原创 【面试准备】数据结构-二叉树

#include using namespace std;templateclass BinTreeNode{private: BinTreeNode *left,*right; T data;public: BinTreeNode(BinTreeNode *lptr,BinTreeNode *rptr,T& item){ left = lptr; right = r

2014-08-02 19:25:36 456

原创 【面试准备】数据结构-堆栈

#include using namespace std;templateclass AStack{private: int size; T* stackArray; int top;public: AStack(int MaxStackSize){ size = MaxStackSize; stackArray = new T[MaxStackSize]; top

2014-08-02 19:23:56 430

原创 【面试准备】数据结构-队列

#include using namespace std;template struct SLNode{ T data; SLNode* next; SLNode(SLNode* nextnode = NULL){ next = nextnode; } SLNode(const T& item,SLNode* nextnode = NULL){ data = item

2014-08-02 19:22:30 378

原创 [面试准备】数据结构--链表

#include using namespace std;//链表节点定义template struct SLNode{ T data; SLNode* next; SLNode(SLNode* nextnode = NULL){ next = nextnode; } SLNode(const T& item,SLNode* nextnode = NULL){ da

2014-08-02 19:20:40 529

空空如也

空空如也

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

TA关注的人

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