亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? permutations.java

?? 非常棒的java數據庫
?? JAVA
字號:
/*
 * Copyright 2004-2008 H2 Group. Licensed under the H2 License, Version 1.0
 * (http://h2database.com/html/license.html).
 * Initial Developer: H2 Group
 */
package org.h2.util;

import org.h2.message.Message;

/**
 * A class to iterate over all permutations of an array.
 * The algorithm is from Applied Combinatorics, by Alan Tucker as implemented in
 * http://www.koders.com/java/fidD3445CD11B1DC687F6B8911075E7F01E23171553.aspx
 */
public class Permutations {

    private Object[] in;
    private Object[] out;
    private int n, m;
    private int[] index;
    private boolean hasNext = true;

    /**
     * Create a new permutations object.
     *
     * @param in the source array
     * @param out the target array
     */
    public Permutations(Object[] in, Object[] out) {
        this(in, out, in.length);
    }

    /**
     * Create a new permutations object.
     *
     * @param in the source array
     * @param out the target array
     * @param m the number of output elements to generate
     */
    public Permutations(Object[] in, Object[] out, int m) {
        this.n = in.length;
        this.m = m;
        if (n < m || m < 0) {
            throw Message.getInternalError("n < m or m < 0");
        }
        this.in = in;
        this.out = out;
        index = new int[n];
        for (int i = 0; i < n; i++) {
            index[i] = i;
        }

        // The elements from m to n are always kept ascending right to left.
        // This keeps the dip in the interesting region.
        reverseAfter(m - 1);
    }

    /**
     * Move the index forward a notch. The algorithm first finds the rightmost
     * index that is less than its neighbor to the right. This is the dip point.
     * The algorithm next finds the least element to the right of the dip that
     * is greater than the dip. That element is switched with the dip. Finally,
     * the list of elements to the right of the dip is reversed.
     * For example, in a permutation of 5 items, the index may be {1, 2, 4, 3,
     * 0}. The dip is 2 the rightmost element less than its neighbor on its
     * right. The least element to the right of 2 that is greater than 2 is 3.
     * These elements are swapped, yielding {1, 3, 4, 2, 0}, and the list right
     * of the dip point is reversed, yielding {1, 3, 0, 2, 4}.
     */
    private void moveIndex() {
        // find the index of the first element that dips
        int i = rightmostDip();
        if (i < 0) {
            hasNext = false;
            return;
        }

        // find the least greater element to the right of the dip
        int leastToRightIndex = i + 1;
        for (int j = i + 2; j < n; j++) {
            if (index[j] < index[leastToRightIndex] && index[j] > index[i]) {
                leastToRightIndex = j;
            }
        }

        // switch dip element with least greater element to its right
        int t = index[i];
        index[i] = index[leastToRightIndex];
        index[leastToRightIndex] = t;

        if (m - 1 > i) {
            // reverse the elements to the right of the dip
            reverseAfter(i);

            // reverse the elements to the right of m - 1
            reverseAfter(m - 1);
        }
    }

    /**
     * Get the index of the first element from the right that is less
     * than its neighbor on the right.
     *
     * @return the index or -1 if non is found
     */
    private int rightmostDip() {
        for (int i = n - 2; i >= 0; i--) {
            if (index[i] < index[i + 1]) {
                return i;
            }
        }
        return -1;
    }

    /**
     * Reverse the elements to the right of the specified index.
     *
     * @param i the index
     */
    private void reverseAfter(int i) {
        int start = i + 1;
        int end = n - 1;
        while (start < end) {
            int t = index[start];
            index[start] = index[end];
            index[end] = t;
            start++;
            end--;
        }
    }

    /**
     * Go to the next lineup, and if available, fill the target array.
     *
     * @return if a new lineup is available
     */
    public boolean next() {
        if (!hasNext) {
            return false;
        }
        for (int i = 0; i < m; i++) {
            out[i] = in[index[i]];
        }
        moveIndex();
        return true;
    }

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久草在线在线精品观看| 亚洲精品在线免费观看视频| 国产一区二区在线视频| 国产精品欧美久久久久一区二区| 日韩欧美一区二区在线视频| 欧洲亚洲国产日韩| 在线观看一区二区视频| 91福利在线观看| 在线观看区一区二| 欧美三级中文字幕| 欧美精品自拍偷拍| 日韩欧美国产小视频| 日韩欧美国产系列| 日本一区二区三区免费乱视频| 精品国产青草久久久久福利| 久久综合色一综合色88| 国产网站一区二区三区| 日韩一区在线看| 一区二区成人在线| 亚洲香蕉伊在人在线观| 日韩主播视频在线| 国产高清精品久久久久| 99久久婷婷国产综合精品| 91国内精品野花午夜精品| 欧美日免费三级在线| 欧美一区午夜精品| 国产亚洲成aⅴ人片在线观看| 国产精品欧美久久久久无广告 | 欧美日韩精品高清| 欧美一区二区三区四区视频| 精品入口麻豆88视频| 中文一区在线播放| 五月婷婷综合网| 国产综合色精品一区二区三区| a亚洲天堂av| 欧美日本韩国一区| 国产日韩精品视频一区| 亚洲国产欧美日韩另类综合| 美女任你摸久久| 91天堂素人约啪| 日韩三级伦理片妻子的秘密按摩| 中文字幕精品一区二区精品绿巨人| 成人欧美一区二区三区小说| 日韩av一级电影| 99在线精品观看| 欧美大片顶级少妇| 亚洲激情图片一区| 国产精品99久久久久久似苏梦涵| 91电影在线观看| 久久久久久久性| 午夜影视日本亚洲欧洲精品| 成人性生交大片免费| 91精品国产乱码| 亚洲自拍与偷拍| 国产成人精品免费视频网站| 欧美一区二区视频观看视频| 亚洲图片另类小说| 国产乱子伦视频一区二区三区 | 午夜精品久久久久久久蜜桃app| 国产精品一区二区视频| 欧美精品色一区二区三区| 亚洲人成人一区二区在线观看 | 北条麻妃一区二区三区| 欧美xxxxx裸体时装秀| 亚洲第一主播视频| 在线视频国内一区二区| 自拍偷拍欧美精品| 丁香婷婷深情五月亚洲| 久久久精品日韩欧美| 免费成人结看片| 欧美日韩国产一二三| 一区二区免费在线播放| 一本大道久久精品懂色aⅴ| 欧美国产精品v| 国产成人一区在线| 久久精品免视看| 国产毛片精品视频| 久久毛片高清国产| 欧美精品亚洲一区二区在线播放| 国产欧美一区二区精品性色超碰 | 欧美另类z0zxhd电影| 亚洲丝袜美腿综合| www.激情成人| 亚洲欧洲日产国码二区| 91视频观看免费| 亚洲与欧洲av电影| 欧美老女人在线| 久久精品国产亚洲高清剧情介绍| 日韩欧美国产三级| 国产在线精品国自产拍免费| 久久久亚洲午夜电影| 成人一级黄色片| 亚洲视频 欧洲视频| 色噜噜狠狠色综合中国| 夜夜嗨av一区二区三区四季av| 欧美一区二区日韩| 欧美一级高清大全免费观看| 一区二区三区在线观看动漫 | 日韩一区二区三区电影| 久久精品国产亚洲高清剧情介绍| 欧美白人最猛性xxxxx69交| 精品夜夜嗨av一区二区三区| 国产亲近乱来精品视频| 99久久久久久| 日精品一区二区三区| 欧美v日韩v国产v| 成人av在线看| 亚洲不卡在线观看| 26uuu另类欧美亚洲曰本| 国产+成+人+亚洲欧洲自线| 亚洲品质自拍视频| 日韩欧美一区二区不卡| 国产成人久久精品77777最新版本| 91伊人久久大香线蕉| 午夜精品久久久久影视| 日韩精品在线一区二区| www.日韩大片| 免费成人小视频| 1区2区3区国产精品| 欧美久久高跟鞋激| 国产成人午夜精品5599| 五月婷婷激情综合| 久久综合久久99| 欧美亚洲国产一区二区三区va| 精品一区二区综合| 一区二区三区不卡视频| 久久精品视频网| 欧美日韩一级二级| 97超碰欧美中文字幕| 久久av资源站| 午夜av一区二区三区| 亚洲图片你懂的| 日韩欧美激情一区| 欧美撒尿777hd撒尿| www.日韩av| 国产不卡视频一区二区三区| 日韩影院在线观看| 一区二区三区视频在线看| 国产欧美日韩不卡免费| 欧美一区二区免费视频| 在线视频综合导航| eeuss鲁一区二区三区| 国模冰冰炮一区二区| 奇米四色…亚洲| 午夜私人影院久久久久| 亚洲制服丝袜一区| 亚洲欧洲综合另类| 最新国产精品久久精品| 中文幕一区二区三区久久蜜桃| 欧美精品一区二区三| 欧美xxxx老人做受| 欧美mv日韩mv亚洲| 日韩欧美一级精品久久| 日韩天堂在线观看| 日韩一区二区不卡| 日韩美女视频在线| 精品日韩成人av| 精品成a人在线观看| 日韩一区国产二区欧美三区| 欧美一区二区免费| 欧美电影免费观看高清完整版| 日韩午夜在线影院| 精品国产一区二区三区久久久蜜月 | 一本到三区不卡视频| 不卡一区二区中文字幕| 国产宾馆实践打屁股91| 国产成人精品aa毛片| 成人黄页在线观看| 91丨porny丨户外露出| 色综合咪咪久久| 欧美日韩免费一区二区三区视频| 精品视频资源站| 欧美精品黑人性xxxx| 日韩一区二区三区视频| 久久亚洲一区二区三区四区| 国产欧美精品国产国产专区| 欧美国产一区视频在线观看| 1区2区3区欧美| 午夜天堂影视香蕉久久| 日本成人在线网站| 国产成人亚洲综合a∨婷婷| 99久久综合精品| 777亚洲妇女| 国产视频亚洲色图| 一区二区三区在线视频免费| 亚洲高清不卡在线观看| 国产乱码精品一区二区三区av| 成人一级片网址| 欧美日韩一区不卡| 久久日一线二线三线suv| 中文字幕制服丝袜成人av| 午夜精品免费在线观看| 国产精品自拍网站| 精品1区2区3区| 久久久久久久综合| 亚洲一区二区黄色| 国产精品亚洲第一区在线暖暖韩国 | av网站一区二区三区| 欧美酷刑日本凌虐凌虐| 国产精品网友自拍|