上一页 1 ··· 7 8 9 10 11 12 13 14 下一页
摘要: Data Types5 Data Typesstring, number, boolean, object, function3 Object Typesobject, array, date2 Other Typesnull, undefinedType ConversionNumber/Bool... 阅读全文
posted @ 2015-06-19 11:03 lilixu 阅读(294) 评论(0) 推荐(0) 编辑
摘要: *稳定指原本数列中相同的元素的相对前后位置在排序后不会被打乱快速排序(n*lgn 不稳定):数组中随机选取一个数x(这里选择最后一个),将数组按比x大的和x小的分成两部分,再对剩余两部分重复这个算法直到结束。但在数据量小的时候表现差。def quick_sort(a) (x = a.pop) ? ... 阅读全文
posted @ 2015-06-18 23:18 lilixu 阅读(227) 评论(0) 推荐(0) 编辑
摘要: Reverse链表。使用三个指针head,a,b,最后head会指向最后一个node,故直接返回head。x -> x -> x -> x => x x => x x => x <- x <- x xh a b a.next = head ... 阅读全文
posted @ 2015-06-17 17:55 lilixu 阅读(288) 评论(0) 推荐(0) 编辑
摘要: 求两个字符串中最长的公共部分的长度长宽为对应两个字符串长度的二维数组dpdp[i][j] = x 表示在s1[i]和s2[j]的位置上,已经有长度为x的公共字串if s1[i] == s2[j] 转移方程为dp[i][j] = dp[i-1][j-1] + 1 注意当一边的下标为0时,dp[i]... 阅读全文
posted @ 2015-06-17 16:31 lilixu 阅读(127) 评论(0) 推荐(0) 编辑
摘要: Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, wh... 阅读全文
posted @ 2015-06-16 23:12 lilixu 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 全称Open Systems Interconnection Model分为 7 层7 Application Data HTTP协议6 Presentation Data ASCII码5 Session Data RPC协议4 Transport Segments TCP/IP协议... 阅读全文
posted @ 2015-06-15 22:14 lilixu 阅读(183) 评论(0) 推荐(0) 编辑
摘要: Given a sorted (increasing order) array, write an algorithm to create a binary tree with minimal height.1.Divide the array equally into left part and ... 阅读全文
posted @ 2015-06-15 22:00 lilixu 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon... 阅读全文
posted @ 2015-06-14 19:51 lilixu 阅读(279) 评论(0) 推荐(1) 编辑
摘要: Given an arraySofnintegers, find three integers inSsuch that the sum is closest to a given number, target. Return the sum of the three integers. You m... 阅读全文
posted @ 2015-06-14 19:14 lilixu 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given an arraySofnintegers, are there elementsa,b,cinSsuch thata+b+c= 0? Find all unique triplets in the array which gives the sum of zero.Note:Elemen... 阅读全文
posted @ 2015-06-14 19:07 lilixu 阅读(187) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 下一页