- 博客(10)
- 问答 (1)
- 收藏
- 关注
Day 7: Object-oriented programming and inheritance
3 primary features of OOP Encapsulation Inheritance Polymorphism
2011-06-29 16:05:59
109
Day 6: User-defined datatypes
class A user-defined datatype which groups together related pieces of information Instance An instance is an occurrence of a class class student{ public: char *name; int studentID; ...
2011-06-29 15:32:47
119
Day 5: Pointers
&x evaluates to the adress of x in memory. *(&x) evaluates to the someting as x. Pointer advantages: More flexible pass-by-reference Manipulate comlex data structure efficiently Use p...
2011-06-28 23:01:22
99
Day 4: Arrays and Strings
Array fixed number of elements of the same type stored sequentially in memory initialization, or unexpected results arrays are passed by reference multidimensional arrays are merely an abstrac...
2011-06-26 15:51:48
114
Day 3: Functions
Why define your own functions? Readability Maintainability Code reuse #include <iostream> using namespace std; int raiseToPower(int base, int exponent) { int result = 1; for (int i...
2011-06-26 15:25:03
75
Day 2: Flow of control
Control structure conditionals if switch loops while do...while for nested control structures 这些都跟java是一致的,谁叫java是从C++改过来的呢?
2011-06-24 22:27:15
128
原创 Day 1:Introduction
1.1 Why use a language like C++ Conciseness Maintainability Portability 1.2 The compilation process sorce file>>>Prcessed code>>>Object file 1.3 General note...
2011-06-24 22:01:44
78
Circular doubly linked list and implementation
class Node<E>{ E item; Node prev, next; Node(E newItem){ item = newItem; prev = next =null; } } class CircularDoublyLinkedList{ private ...
2011-05-09 18:37:42
128
由preOrder和inOrder构建二叉树
Let us consider the below traversals: Inorder sequence: D B E A F CPreorder sequence: A B D E C F In a Preorder sequence, leftmost element is the root of the tree. So we know ‘A’ is root for...
2011-05-09 16:29:41
968
二叉树和图:确定能否从一个点遍历到另一个节点
Use recursion and traversal to solve. boolean BSTbranch(TreeNode start, TreeNode end){ if(start == end) return true; if(start != null){ if(!BSTbranch(start.left, end){ if(...
2011-05-06 12:54:01
232
空空如也
从M个数中任意选出N个数,罗列出所有的情况
2011-05-06
TA创建的收藏夹 TA关注的收藏夹
TA关注的人