摘要:
1 class noncopyable 2 { 3 public: 4 noncopyable(){} 5 ~noncopyable(){} 6 private: 7 noncopyable(const noncopyable &){} 8 noncopyable &operator=(const noncopyable&){} 9 }; 10 ... 阅读全文
摘要:
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size tha 阅读全文
摘要:
Given a binary tree, return the inorder traversal of its nodes' values. For example:Given binary tree [1,null,2,3], return [1,3,2]. 用的递归方法,提示上说递归方法太普通 阅读全文
摘要:
先看上面一段简单代码,写的很简单的浅拷贝,之前对于复制构造函数存在相当多的不理解。 (1)不理解为什么参数要写成引用,后来看了剑指offer后,上面说如果不写成引用,调用A的复制构造函数时参数会copy,此时会调用自己本身的复制构造函数,所以一层层的调用,直到栈溢出。 (2)赋值运算符函数为什么要返 阅读全文
摘要:
Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally ident 阅读全文
摘要:
该篇文章为转载,是对原作者系列文章的总汇加上标注。 支持原创,请移步陈浩大神博客: http://blog.csdn.net/haoel/article/details/2886 makefile很重要 什么是makefile?或许很多Winodws的程序员都不知道这个东西,因为那些Windows的 阅读全文
摘要:
1 #define MAX_ARRAY_SIZE 21 2 int array[MAX_ARRAY_SIZE] = {1,2,4,8,0,0,9,0,0,5,10,0,0,0,3,6,0,0,7,0,0}; 3 static int index = 0; 4 5 typedef struct binary_tree_t 6 { 7 int data; 8 str... 阅读全文
摘要:
问题描述: 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. 代码 阅读全文
摘要:
问题描述: Given an array and a value, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array 阅读全文
摘要:
问题描述: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, 阅读全文