码迷,mamicode.com
首页 >  
搜索关键字:reference value    ( 43034个结果
查找元素在list中的位置以及折半查询
问题 查找某个值在list中的位置 解决思路 可以用折半查询的方法解决此问题。 解决(Python) #! /usr/bin/env python #coding:utf-8 #折半查找某个元素在list中的位置 def half_search(lst,value,left,right): length = len(lst) while left<ri...
分类:其他好文   时间:2014-06-19 11:09:48    阅读次数:527
Pow(x, n)
题目 Implement pow(x, n). 方法 注意Integer.MIN_VALUE值和Integer.MAX_VALUE值。 public double pow(double x, int n) { if (n == 0) { return 1; } if (n == Integer.MIN_VAL...
分类:其他好文   时间:2014-06-19 10:37:27    阅读次数:210
C# 2012 step by step 学习笔记8 CHAPTER 9 Creating Value types with enumerations and Structures
C# 2012 step by step.学习笔记摘录...
分类:其他好文   时间:2014-06-19 09:39:57    阅读次数:285
lua的弱弱引用表
lua有GC,细节无需太关注,知道些基本的就行,能local就一定不要global; 还有在数组里的对象,除非显式=nil,否则很难回收; 不过可以用弱引用表来告诉GC。外部引用为0,就不要管我,请del it。 weak table是通过元表实现,元表里的__mode字段包含k或者v;k表示key为弱引用;v表示value为弱引用。 1、首先看一个普通的例子: a = {} ke...
分类:其他好文   时间:2014-06-16 11:57:59    阅读次数:306
Search for a Range
题目 Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's runtime complexity must be in the order of O(log n). If the target i...
分类:其他好文   时间:2014-06-15 16:53:32    阅读次数:177
[LeetCode] Search for a Range [34]
题目 Given a sorted array of integers, find the starting and ending position of a given target value. 解题思路: 查找一个数出现的范围,给一个排好序的数组和一个数,找出这个数在数组中出现的范围。 这个题直接使用一次遍历就可以得到结果,这样的时间复杂度为O(n)。但是对于有序数组我们一般可以使用二分查找可以得到更好的O(logn)的时间复杂度。我们可以使用二分查找找到这个数第一次出现的位置和这个数最后一次出现的位...
分类:其他好文   时间:2014-06-15 16:19:16    阅读次数:237
cocos2dx跨平台使用自定义字体
首先需要一个ttf文件的字体。在ios中的方法:把ttf文件放入资源文件下,然后在你的工程的Info.plist文件中新建一行(Add Row),添加key为:Fonts provided by application,类型为Array或Dictionary都行;添加Value为XXX.ttf(你字...
分类:其他好文   时间:2014-06-13 19:56:52    阅读次数:428
解决php函数json_encode转换后中文被编码为unicode
大家都知道使用函数json_encode()可以方便快捷地将数组进行json编码转换,但是如果数组值存在着中文,json_encode会将中文转换为unicode编码,例如:$value){ $data[] = urlencode($value);}echo urldecode(json_en...
分类:Web程序   时间:2014-06-13 19:49:45    阅读次数:510
jquery 根据值设置radio选中状态
radio选中$("input[name=test][value=34]").attr("checked",true);//value=34的radio被选中$("input[id=testid][value=34]").attr("checked",true);//value=34的radio被选...
分类:Web程序   时间:2014-06-13 19:23:59    阅读次数:698
[2013] 链表逆序
题目二:逆序链表输出。题目描述: 将输入的一个单向链表,逆序后输出链表中的值。链表定义如下:typedef struct tagListNode { int value; struct tagListNode *next; }ListNode; 要求实现函数: void converse...
分类:其他好文   时间:2014-06-13 18:35:48    阅读次数:203
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!