码迷,mamicode.com
首页 >  
搜索关键字:-__nscfnumber length    ( 19569个结果
使用R完成字符串的子字符串频率统计
整理自统计之都论坛 方法一   使用strsplit函数 a <- "aggcacggaaaaacgggaataacggaggaggacttggcacggcattacacggagg" b <- strsplit(as.character(a),"ag") length(b[[1]]) - 1 ##子字符串"ag"的出现个数 方法二   使用正则式函数 a <- "aggcacgg...
分类:其他好文   时间:2014-07-22 23:02:52    阅读次数:288
【LeetCode】- Length of Last Word(最后一个单词的长度)
[ 问题: ] Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. [...
分类:其他好文   时间:2014-07-22 23:01:35    阅读次数:331
Chap5: question: 29 - 31
29:数组中出现次数超过一半的数字 方法a. 排序取中 O(nlogn) 方法b. partition 函数分割找中位数 >=O(n) 方法 c. 设计数变量,扫描一遍。 O(n)#include int findNumber(int data[], unsigned length){/* if(c...
分类:其他好文   时间:2014-05-02 19:47:41    阅读次数:535
Leetcode: Length of Last Word
许多次通过,主要是没有考虑到这种情况:“A C ”结尾有多重空格的情况。 1 public class Solution { 2 public int lengthOfLastWord(String s) { 3 int j, k; 4 if(s == nu...
分类:其他好文   时间:2014-05-02 08:21:00    阅读次数:300
String构造器中originalValue.length>size 发生的情况
最近在看Jdk6中String的源码的时候发现String的有个这样的构造方法,源代码内容如下: public String(String original) { int size = original.count; char[] originalValue = original.value; char[] v; if (originalValue.length > size) { ...
分类:其他好文   时间:2014-05-02 06:34:52    阅读次数:237
桶排序
1 //桶排序思想 2 //假如要排序的是数字是 2 4 5 5 5 8 8 9 1 1 3 #include 4 #define length 10 5 int main() 6 { 7 //数组元素值全部初始化为0 8 int array[length]={0}; 9 ...
分类:其他好文   时间:2014-05-01 22:19:46    阅读次数:342
LeetCode5:Longest Palindromic Substring
题目: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique lo...
分类:其他好文   时间:2014-05-01 20:07:13    阅读次数:429
JS 字符unicode转换函数
/**js Unicode编码转换*/vardecToHex =function(str) {varres=[];for(vari=0;i < str.length;i++) res[i]=("00"+str.charCodeAt(i).toString(16)).slice(-4);return"...
分类:Web程序   时间:2014-05-01 19:36:51    阅读次数:427
七大排序算法(冒泡,选择,插入,希尔,快速,合并,堆排序)的java实现
冒泡排序 思路:就是每次将最大或最小的元素放到数组的最后,so easy!时间复杂度为(O(n^2)) public class BubbleSort { public static void bubbleSort(int[] a) { for (int j = 1; j < a.length; j++) { for (int i = 0; i < a.length - j; i+...
分类:编程语言   时间:2014-04-30 22:12:40    阅读次数:309
链表《2》使用函数操作链表
使用函数操作链表 1:计算链表中结点的个数:定义一个Length_list()函数用于计算链表中结点的个数 函数代码: //计算链表中结点的个数 void Length_list(PNODE pHead) { PNODE p = pHead->pNext; int len = 0; while(NULL != p) { len++; p = p->pNext; ...
分类:其他好文   时间:2014-04-29 13:28:21    阅读次数:302
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!