Problem Description:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the no...
分类:
其他好文 时间:
2014-07-07 16:41:56
阅读次数:
141
【题目】
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorder it to {1,4,2,3}.
【题意】
给定一个链表L: L0→L1→…→Ln-1→Ln,对他重新排序成L...
分类:
其他好文 时间:
2014-06-30 10:11:14
阅读次数:
158
Reorder ListGiven a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' val...
分类:
其他好文 时间:
2014-06-28 20:42:16
阅读次数:
265
#include #include #include #include using namespace std;char a[1010],b[1010];int ta[1010],tb[1010];int main(){ int l2,l1,l; while(scanf("%s%s",a...
分类:
其他好文 时间:
2014-06-28 17:39:49
阅读次数:
189
Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You must do this in-place without altering the nodes' values.For exam...
分类:
其他好文 时间:
2014-06-26 23:04:14
阅读次数:
221
Given a singly linked list L: L0→L1→…→Ln-1→Ln,
reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→…
You must do this in-place without altering the nodes' values.
For example,
Given {1,2,3,4}, reorder it t...
分类:
其他好文 时间:
2014-06-24 21:55:30
阅读次数:
279
方法:先reshape成行向量或者列向量然后,利用mean函数,std函数。构造测试数据,可以利用random函数,就好。利用这个函数,可以构造不同分布的随机数列(或 矩阵)。如:>> y =random('norm',2,0.3,3,4)y = 2.1391 2.2945 2.0...
分类:
其他好文 时间:
2014-06-20 17:18:28
阅读次数:
221
let btn1 = UIButton.buttonWithType(.System) as UIButtonbtn1.backgroundColor = UIColor.redColor()btn1.setTitle("Button1", forState: UIControlState.Norm...
分类:
其他好文 时间:
2014-06-18 13:02:14
阅读次数:
141
package com.he.list;
public class Collections {
public static ArrayList mergeList(ArrayList l1, ArrayList l2) {
ArrayList l = new ArrayList();
int l1_length = l1.getLength();
int l2_length = ...
分类:
其他好文 时间:
2014-06-17 22:53:46
阅读次数:
247
写了一个合并有序链表,代码有点纠结啊,涉及到指针就是麻烦,DS课曹老师课件说linklist是DS的难点。。。
如果数组就很简单了,链表就要小心。
里面遇到的一些情况,第一,最好是先确定l1归到l2还是相反,我是把l1归到L2,返回l2, 而且要先把l2的位置定好,只要比较第一次就可以确定了。否则后面写逻辑那叫一个纠结啊。。。
然后后面比较两个大小,类似于数组归并,prev1,prev1表示...
分类:
其他好文 时间:
2014-06-17 21:55:44
阅读次数:
207