当前位置: 首页>>代码示例>>Java>>正文


Java IntStack类代码示例

本文整理汇总了Java中edu.jhu.prim.list.IntStack的典型用法代码示例。如果您正苦于以下问题:Java IntStack类的具体用法?Java IntStack怎么用?Java IntStack使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IntStack类属于edu.jhu.prim.list包,在下文中一共展示了IntStack类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNumReachable

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private int getNumReachable(int root) {
    boolean[] marked = new boolean[n+1];
    Arrays.fill(marked, false);
    // Run a depth-first search (excluding edges to the root) starting at the given token, and mark all reachable tokens.
    IntStack stack = new IntStack();
    stack.push(root);
    int numMarked = 0;
    while (stack.size() > 0) {
        int p = stack.pop();
        if (marked[p+1]) {
            continue;
        }
        for (int c=0; c<n; c++) {
            if (p != c && !marked[c+1] && this.isKept(p, c)) {
                stack.push(c);
            }
        }
        marked[p+1] = true;
        numMarked++;
    }
    return numMarked;
}
 
开发者ID:mgormley,项目名称:pacaya-nlp,代码行数:23,代码来源:DepEdgeMask.java

示例2: quicksort

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksort(double[] array, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partition(array, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:DoubleSort.java

示例3: quicksortValues

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksortValues(double[] array, long[] index, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partitionValues(array, index, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:LongDoubleSort.java

示例4: quicksortIndex

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksortIndex(long[] array, double[] values, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array  so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partitionIndex(array, values, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:LongDoubleSort.java

示例5: quicksort

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksort(long[] array, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partition(array, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:LongSort.java

示例6: quicksort

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksort(byte[] array, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partition(array, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:ByteSort.java

示例7: quicksortValues

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksortValues(double[] array, int[] index, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partitionValues(array, index, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:IntDoubleSort.java

示例8: quicksortIndex

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksortIndex(int[] array, double[] values, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array  so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partitionIndex(array, values, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:IntDoubleSort.java

示例9: quicksort

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksort(float[] array, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partition(array, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:FloatSort.java

示例10: quicksortValues

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksortValues(int[] array, long[] index, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partitionValues(array, index, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:LongIntSort.java

示例11: quicksortIndex

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksortIndex(long[] array, int[] values, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array  so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partitionIndex(array, values, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:LongIntSort.java

示例12: quicksortValues

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksortValues(int[] array, int[] index, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partitionValues(array, index, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:IntIntSort.java

示例13: quicksortIndex

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksortIndex(int[] array, int[] values, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array  so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partitionIndex(array, values, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:IntIntSort.java

示例14: quicksort

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksort(int[] array, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partition(array, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:IntSort.java

示例15: quicksortValues

import edu.jhu.prim.list.IntStack; //导入依赖的package包/类
private static void quicksortValues(float[] array, int[] index, int left, int right, boolean asc) {
    IntStack leftStack = new IntStack();
    IntStack rightStack = new IntStack();
    leftStack.add(left);
    rightStack.add(right);
    while (leftStack.size() > 0) {
        left = leftStack.pop();
        right = rightStack.pop();
        if (left < right) {
            // Choose a pivot index.
            // --> Here we choose the rightmost element which does the least
            // amount of work if the array is already sorted.
            int pivotIndex = right;
            // Partition the array so that everything less than
            // values[pivotIndex] is on the left of pivotNewIndex and everything
            // greater than or equal is on the right.
            int pivotNewIndex = partitionValues(array, index, left, right, pivotIndex, asc);
            // "Recurse" on the left side.
            leftStack.push(left);
            rightStack.push(pivotNewIndex - 1);
            // "Recurse" on the right side.
            leftStack.push(pivotNewIndex + 1);
            rightStack.push(right);
        }
    }
}
 
开发者ID:mgormley,项目名称:prim,代码行数:27,代码来源:IntFloatSort.java


注:本文中的edu.jhu.prim.list.IntStack类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。