thinking:
(1)每次选择输出的数字是当前序列中最小的,记该数字下标为 index,数字为a
(2)检查index 之后的最小数为b
(3)如果index之前有小于b且大于a的数字出现,说明这些数字是乱序的数字,要和a一行保序输出
code:
int output_in_order(vector &unordered_sequence)
{
int next_ou...
分类:
其他好文 时间:
2015-04-03 11:32:01
阅读次数:
129
Caused by : Could not instantiate bean class [] : Constructor threw exception; nested exception is java.lang.NoClassDefFoundError:flexjson/JSONSerializer
Caused by : java.lang.NoClassDefFoundError:flexjson/JSONSerializer...
分类:
编程语言 时间:
2015-04-03 11:28:14
阅读次数:
176
最大连续子序列
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 21166 Accepted Submission(s): 9387
Problem Description
给定K个整数的序列{ N1, N2...
分类:
其他好文 时间:
2015-04-03 11:26:13
阅读次数:
149
题目地址:https://leetcode.com/problems/median-of-two-sorted-arrays/
这道题就是求两个有序序列的中位数。这也是2015年4月阿里实习生招人附加题第一题
我用的是归并算法,时间复杂度和空间复杂度都为O(M+N)
class Solution {
public:
double findMedianSortedArrays(int ...
分类:
其他好文 时间:
2015-04-03 11:18:54
阅读次数:
134
/// /// 根据日期和随机码生成订单号 /// /// public string GetOrderNumber() { string num = DateTime.Now.ToString("y...
分类:
其他好文 时间:
2015-04-03 11:06:41
阅读次数:
138
本文出自地址: http://www.cnblogs.com/freshman0216/p/4161800.html#undefinedNewtonsoft.Json,一款.NET中开源的Json序列化和反序列化类库(下载地址http://json.codeplex.com/)。下面是Json序列化...
分类:
Web程序 时间:
2015-04-03 10:52:28
阅读次数:
179
http://www.cnblogs.com/lxsweat/p/4372508.html上代码其中的使用方法和UserInfo实体对象就不贴代码了。 /// /// 把对象转成json字符串 /// /// 对象 /// j...
分类:
Web程序 时间:
2015-04-03 10:51:09
阅读次数:
135
一.先从Serialize说起 我们都知道JAVA中的Serialize机制,译成串行化、序列化……,其作用是能将数据对象存入字节流其中,在须要时又一次生成对象。主要应用是利用外部存储设备保存对象状态,以及通过网络传输对象等。二.Android中的新的序列化机制 在Android系统中,定位为针对内...
分类:
移动开发 时间:
2015-04-03 10:47:37
阅读次数:
142
按自己的思想简单写了一下,多多交流。#include "stdafx.h"
int insertInOrder(int *a,int num,int len){
int position;
if (a[0]==0)
{
a[0] = num;
position = 1;
}
for (int i = 0; i a[i] && n...
分类:
其他好文 时间:
2015-04-03 09:22:10
阅读次数:
120
直接上代码: public static class XmlSerializer { public static void SaveToXml(string filePath, object sourceObj, Type type) { if...