码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
数据结构:链表的基本操作(创建,删除,插入,逆序,摧毁)
代码注释比较详细: #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
codeigniter 操作mysql的PHP代码--更新
支持标前缀 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
【剑指offer】Q17:合并两个排序的链表
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
[Ruby]Guide to return statement
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
【剑指offer】Q9:斐波那契数列
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
【剑指offer】Q16:翻转链表
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
【剑指offer】Q19:二叉树的镜像
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
【DataStructure】Some useful methods about linkedList(三)
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
C++隐式转换
#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
【剑指offer】Q14:调整数组顺序使奇数位于偶数前面
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
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!