冒泡排序:#!/usr/bin/envpython
#encoding:utf-8
"""
@version:??
@author:phpergao
@license:ApacheLicence
@file:冒泡排序.py
@time:2016/8/510:11
"""
defmaopao_sort(array):
foriinrange(len(array)):
forjinrange(len(array)-1-i,):
ifarray[j]>array[j+1]:
tmp=a..
分类:
编程语言 时间:
2016-08-05 18:08:15
阅读次数:
255
一、特点 二、创建方法 三、检测数组 四、转换方法 toString(),toLocaleString()返回的都是字符串,并以,分隔 join()返回的也是字符串,以join函数内部的参数分隔,对原数组没有影响 valueOf()返回的是数组,可以通过这种方式将一个数组赋给另一个数组若对这个数组操 ...
分类:
Web程序 时间:
2016-08-05 15:23:28
阅读次数:
213
//多维数组排序private function my_sort($arrays,$sort_key,$sort_order=SORT_ASC,$sort_type=SORT_NUMERIC){ if(is_array($arrays)){ foreach ($arrays as $array){ ...
分类:
编程语言 时间:
2016-08-05 13:48:09
阅读次数:
165
(LeetCode)Rotate Array --- 逆置数组...
分类:
编程语言 时间:
2016-08-05 10:16:49
阅读次数:
195
Verify Preorder Sequence in Binary Search Tree \Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary se ...
分类:
其他好文 时间:
2016-08-05 06:34:51
阅读次数:
166
Question:
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will us...
分类:
其他好文 时间:
2016-08-05 01:01:56
阅读次数:
119
1 var assert = require('chai').assert; 2 3 describe('Array', function() { 4 describe('#indexOf()', function() { 5 it('should return -1 when the value ...
分类:
编程语言 时间:
2016-08-05 00:54:04
阅读次数:
116
首先要介绍一下对象的定义和作用: 对象其实就是一组无序属性的集合,对象是由属性和方法组成的,事物特有的特征叫属性,事物拥有的行为叫方法 对象可以帮助我们封装一些数据,方便我们在程序中传输或者控制 程序中常见的对象主要有三种:Math Array function,现实生活中其实万物皆对象 程序中除了 ...
分类:
其他好文 时间:
2016-08-04 23:04:14
阅读次数:
253
userAgentInfo.indexOf(Agents[v]): //A.indexOf(array[i]):A元素是否存在于数组array里面;如果存在就会返回对应的下标,如果不存在则返回-1. function IsPC(){ var userAgentInfo = navigator.use ...
分类:
其他好文 时间:
2016-08-04 22:53:40
阅读次数:
1073
Remove Duplicates from sorted array问题描述Given a sorted array, remove the duplicates in place such that each element appear only once
and return the new length.
Do not allocate extra space for another...
分类:
其他好文 时间:
2016-08-04 21:42:19
阅读次数:
159