摘要:
二叉树的递归先序遍历很简单,假设二叉树的结点定义如下:1 struct BinaryTreeNode2 {3 int m_nValue;4 BinaryTreeNode* m_pLeft;5 BinaryTreeNode* m_pRight;6 };递归先序遵循:根-左-... 阅读全文
摘要:
题目:从上往下打印出二叉树的每个结点,同一层的结点按照从左到右的顺序打印。例如输入图4.5中的二叉树,则依次打印出8、6、10、5、7、9、11二叉树结点的定义如下:1 struct BinaryTreeNode2 {3 int m_nValue;4 BinaryTreeNode* ... 阅读全文
摘要:
其实我们从直观上可以很好的理解静态成员函数不能调用非静态成员变量这句话因为无论是静态成员函数还是静态成员变量,它们都是在类的范畴之类的,及在类的整个生存周期里始终只能存在一份。然而非静态成员变量和非静态成员函数是针对类的对象而言。然而从本质上来说类的静态成员函数的函数形参中没有默认的this指针,导... 阅读全文
摘要:
关于进程的内存的分配参考博文:http://blog.csdn.net/hongchangfirst/article/details/6917829这里主要说说堆区和栈区的区别:1.堆区是程序里动态分配的内容,堆区的内存容量大,使用灵活,分别后要自行回收容易产生内存碎片。2.栈区主要是存储函数的局部... 阅读全文
摘要:
先介绍一个问题,一个空类的大小是多少?我们不妨测试一下: 1 #include 2 using namespace std; 3 4 class vpoet 5 { 6 7 }; 8 9 int main()10 {11 cout<<"sizeof(vpoet)="<<sizeof(... 阅读全文
摘要:
内存对齐其实是为了在程序运行的时候更快的查找内存而做的一种编译器优化。我们先看这样一个例子: 1 #include 2 using namespace std; 3 4 struct vpoet 5 { 6 int a; //4 bytes 7 char b; //1 b... 阅读全文
摘要:
Suppose that a website contains two tables, theCustomerstable and theOrderstable. Write a SQL query to find all customers who never order anything.Tab... 阅读全文
摘要:
Write a SQL query to find all duplicate emails in a table namedPerson.+----+---------+| Id | Email |+----+---------+| 1 | a@b.com || 2 | c@d.com |... 阅读全文
摘要:
TheEmployeetable holds all employees including their managers. Every employee has an Id, and there is also a column for the manager Id.+----+-------+-... 阅读全文
摘要:
Table:Person+-------------+---------+| Column Name | Type |+-------------+---------+| PersonId | int || FirstName | varchar || LastName ... 阅读全文