代码注释比较详细:
#include
#include
using namespace std;
struct Node{
int data;
Node* next;
};
Node* head = NULL;
bool create() {
head = (Node*)malloc(sizeof(Node));
if(NULL == head) return false;...
分类:
其他好文 时间:
2014-07-08 21:05:05
阅读次数:
238
支持标前缀
1)查询不等于且有等于
$this->db->get_where('host',array('host'=>'ddd','id !='=>0))->row();
2)2表相交
return $this->db
->select('f.*,count(s.id) as subtotal')
->f...
分类:
数据库 时间:
2014-07-08 20:05:19
阅读次数:
241
def Merge(head1, head2):
if head1 == None: return head2
if head2 == None: return head1
psuhead = ListNode(-1)
tail = psuhead
while head1 and head2:
if head1.val < head2.val:
cur = head1
...
分类:
其他好文 时间:
2014-07-08 18:46:04
阅读次数:
227
In Ruby language, the return statement in the Ruby functions are interesting, Let's explore them as below:...
分类:
其他好文 时间:
2014-07-08 17:19:12
阅读次数:
177
def Fibonacci(n):
if n <= 0:
return 0
if n <= 1:
return n
f0 = 0; f1 = 1
for i in range(2, n + 1):
fn = f0 + f1
f0 = f1
f1 = fn
return fn...
分类:
其他好文 时间:
2014-07-08 16:42:03
阅读次数:
163
def reverse(head):
if head == None or head.next == None:
return head
psuhead = ListNode(-1)
while head:
nexthead = head.next
head.next = psuhead.next
psuhead.next = head
head = nexthead
...
分类:
其他好文 时间:
2014-07-08 15:27:58
阅读次数:
183
def MirroRecursively(root):
# root is None or just one node, return root
if None == root or None == root.left and None == root.right:
return root
root.left, root.right = root.right, root.left
Mi...
分类:
其他好文 时间:
2014-07-08 14:26:08
阅读次数:
221
Method 4: Gets the value of element number i
For example, if list is {22, 33, 44, 55, 66, 77, 88, 99}, then get(list, 2) will return 44.
Solution 1:
static int get(Node list, int i) {
if (i < 0) ...
分类:
其他好文 时间:
2014-07-08 14:07:52
阅读次数:
262
#include
using namespace std;
class A
{
int a;
public:
A(int n):a(n)
{
cout << "Constructor!" << endl;
}
~A()
{
cout << "Destructor!" << endl;
}
};
int main()
{
A a = 10;
return 0;...
分类:
编程语言 时间:
2014-07-08 13:45:04
阅读次数:
184
def isOdd(n):
return n & 1
def Reorder(data, cf = isOdd):
odd = 0
even = len( data ) - 1
while True:
while not isOdd( data[ even ]) : even -= 1
while isOdd( data[ odd ]) : odd += 1
if odd ...
分类:
其他好文 时间:
2014-07-08 12:47:26
阅读次数:
276