Java Stack Usage getPermutationsRec(List permutations, byte[] order, List> remaining, int index)

Here you can find the source of getPermutationsRec(List permutations, byte[] order, List> remaining, int index)

Description

get Permutations Rec

License

Open Source License

Declaration

private static void getPermutationsRec(List<byte[]> permutations, byte[] order, List<Stack<Byte>> remaining,
            int index) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.List;
import java.util.Stack;

public class Main {
    private static void getPermutationsRec(List<byte[]> permutations, byte[] order, List<Stack<Byte>> remaining,
            int index) {
        if (order[order.length - 1] != 0) {
            permutations.add(order.clone());
        }/*from ww  w.  j a  v  a2  s .  c om*/
        for (Stack<Byte> stack : remaining) {
            if (stack.empty()) {
                // nothing
            } else {
                order[index] = stack.pop();
                getPermutationsRec(permutations, order, remaining, index + 1);
                stack.push(order[index]);
                order[index] = 0;
            }
        }

    }
}

Related

  1. endsWithIgnoreWhiteSpace(String decl, String token)
  2. getBinary(long input)
  3. getOperands(Stack stack, int nOperands)
  4. getPostOrder(List inOrderList)
  5. getRelativePath(Stack pathStack)
  6. getSyllables(String pinyin)
  7. isDoubleQuote(Stack bufStack)