Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
20
21
content
stringlengths
337
2.14k
max_stars_repo_path
stringlengths
40
71
quixbugs-java_data_1
package java_programs; import java.util.*; import java.lang.Math.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class NEXT_PALINDROME { public static String next_palindrome(int[] digit_list) { int high_mid = Mat...
QuixBugs/QuixBugs/java_programs/NEXT_PALINDROME.java
quixbugs-java_data_2
package java_programs; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class FIND_IN_SORTED { public static int binsearch(int[] arr, int x, int start, int end) { if (start == end) { return -1; } ...
QuixBugs/QuixBugs/java_programs/FIND_IN_SORTED.java
quixbugs-java_data_3
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class LEVENSHTEIN { public static int levenshtein(String source, String target) { if (source.isEmpty() || target.isEmpty()) ...
QuixBugs/QuixBugs/java_programs/LEVENSHTEIN.java
quixbugs-java_data_4
package java_programs; import java.util.*; import java.util.function.BinaryOperator; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class RPN_EVAL { public static Double rpn_eval(ArrayList tokens) { Map<String, Bi...
QuixBugs/QuixBugs/java_programs/RPN_EVAL.java
quixbugs-java_data_5
package java_programs; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class BITCOUNT { public static int bitcount(int n) { int count = 0; while (n != 0) { n = (n ^ (n - 1)); count++; } retur...
QuixBugs/QuixBugs/java_programs/BITCOUNT.java
quixbugs-java_data_6
package java_programs; import java.util.*; import java.lang.Math.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Angela Chen */ public class SHORTEST_PATH_LENGTHS { // Define Infinite as a large enough value. This value will be used // f...
QuixBugs/QuixBugs/java_programs/SHORTEST_PATH_LENGTHS.java
quixbugs-java_data_7
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class LONGEST_COMMON_SUBSEQUENCE { public static String longest_common_subsequence(String a, String b) { if (a.isEmpty() ||...
QuixBugs/QuixBugs/java_programs/LONGEST_COMMON_SUBSEQUENCE.java
quixbugs-java_data_8
package java_programs; import java.util.*; /** * * @author Angela Chen */ public class SHORTEST_PATH_LENGTH { public static int shortest_path_length(Map<List<Node>, Integer> length_by_edge, Node startnode, Node goalnode) { int n = length_by_edge.size(); // the shortest distance from source to e...
QuixBugs/QuixBugs/java_programs/SHORTEST_PATH_LENGTH.java
quixbugs-java_data_9
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class REVERSE_LINKED_LIST { public static Node reverse_linked_list(Node node) { Node prevnode = null; Node nextnode...
QuixBugs/QuixBugs/java_programs/REVERSE_LINKED_LIST.java
quixbugs-java_data_10
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class LCS_LENGTH { public static Integer lcs_length(String s, String t) { // make a Counter // pair? no! just hashta...
QuixBugs/QuixBugs/java_programs/LCS_LENGTH.java
quixbugs-java_data_11
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class PASCAL { public static ArrayList<ArrayList<Integer>> pascal(int n) { ArrayList<ArrayList<Integer>> rows = new ArrayLi...
QuixBugs/QuixBugs/java_programs/PASCAL.java
quixbugs-java_data_12
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class IS_VALID_PARENTHESIZATION { public static Boolean is_valid_parenthesization(String parens) { int depth = 0; fo...
QuixBugs/QuixBugs/java_programs/IS_VALID_PARENTHESIZATION.java
quixbugs-java_data_13
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class MAX_SUBLIST_SUM { public static int max_sublist_sum(int[] arr) { int max_ending_here = 0; int max_so_far = 0;...
QuixBugs/QuixBugs/java_programs/MAX_SUBLIST_SUM.java
quixbugs-java_data_14
package java_programs; import java.util.*; import java.lang.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class KNAPSACK { public static int knapsack(int capacity, int [][] items) { int weight = 0, value = 0; ...
QuixBugs/QuixBugs/java_programs/KNAPSACK.java
quixbugs-java_data_15
package java_programs; import java.util.*; public class TOPOLOGICAL_ORDERING { public static ArrayList<Node> topological_ordering (List<Node> directedGraph) { ArrayList<Node> orderedNodes = new ArrayList<Node>(); for (Node node : directedGraph) { if (node.getPredecessors().isEmpty()) { ...
QuixBugs/QuixBugs/java_programs/TOPOLOGICAL_ORDERING.java
quixbugs-java_data_16
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class POSSIBLE_CHANGE { public static int possible_change(int[] coins, int total) { if (total == 0) { return 1; ...
QuixBugs/QuixBugs/java_programs/POSSIBLE_CHANGE.java
quixbugs-java_data_17
package java_programs; import java.util.*; import java.util.ArrayDeque; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class BREADTH_FIRST_SEARCH { public static Set<Node> nodesvisited = new HashSet<>(); public stat...
QuixBugs/QuixBugs/java_programs/BREADTH_FIRST_SEARCH.java
quixbugs-java_data_18
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class HANOI { // default start=1, end=3 public static List<Pair<Integer,Integer>> hanoi(int height, int start, int end) { ...
QuixBugs/QuixBugs/java_programs/HANOI.java
quixbugs-java_data_19
package java_programs; import java.util.*; import java.lang.Math.*; /** * * @author Angela Chen */ public class SHORTEST_PATHS { // Define Infinite as a large enough value. This value will be used // for vertices not connected to each other final static int INF = 99999; public static Map<String, ...
QuixBugs/QuixBugs/java_programs/SHORTEST_PATHS.java
quixbugs-java_data_20
package java_programs; import java.util.*; /* */ public class KTH { public static Integer kth(ArrayList<Integer> arr, int k) { int pivot = arr.get(0); ArrayList<Integer> below, above; below = new ArrayList<Integer>(arr.size()); above = new ArrayList<Integer>(arr.size()); fo...
QuixBugs/QuixBugs/java_programs/KTH.java
quixbugs-java_data_21
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class GCD { public static int gcd(int a, int b) { if (b == 0) { return a; } else { return ...
QuixBugs/QuixBugs/java_programs/GCD.java
quixbugs-java_data_22
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class SHUNTING_YARD { public static List shunting_yard(ArrayList tokens) { Map<String, Integer> precedence = new HashMap<St...
QuixBugs/QuixBugs/java_programs/SHUNTING_YARD.java
quixbugs-java_data_23
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class GET_FACTORS { public static ArrayList<Integer> get_factors(int n) { if (n == 1) { return new ArrayList<In...
QuixBugs/QuixBugs/java_programs/GET_FACTORS.java
quixbugs-java_data_24
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class DEPTH_FIRST_SEARCH { public static boolean depth_first_search(Node startnode, Node goalnode) { Set<Node> nodesvisited ...
QuixBugs/QuixBugs/java_programs/DEPTH_FIRST_SEARCH.java
quixbugs-java_data_25
package java_programs; import java.util.*; public class Node { private String value; private ArrayList<Node> successors; private ArrayList<Node> predecessors; private Node successor; public Node() { this.successor = null; this.successors = new ArrayList<Node>(); this.prede...
QuixBugs/QuixBugs/java_programs/Node.java
quixbugs-java_data_26
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class MERGESORT { public static ArrayList<Integer> merge(ArrayList<Integer> left, ArrayList<Integer> right) { //System.out.prin...
QuixBugs/QuixBugs/java_programs/MERGESORT.java
quixbugs-java_data_27
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class KHEAPSORT { // import heapq // heap is data structure used for priority queue // pq O(log n) to pull off lowest priori...
QuixBugs/QuixBugs/java_programs/KHEAPSORT.java
quixbugs-java_data_28
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class WRAP { public static void main(String[] args) { System.out.println("abc".lastIndexOf("c",30)); } public stat...
QuixBugs/QuixBugs/java_programs/WRAP.java
quixbugs-java_data_29
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class SIEVE { public static boolean all(ArrayList<Boolean> arr) { for (boolean value : arr) { if (!value) { re...
QuixBugs/QuixBugs/java_programs/SIEVE.java
quixbugs-java_data_30
package java_programs; import java.util.*; /** * Minimum spanning tree */ public class MINIMUM_SPANNING_TREE { public static Set<WeightedEdge> minimum_spanning_tree(List<WeightedEdge> weightedEdges) { Map<Node,Set<Node>> groupByNode = new HashMap<>(); Set<WeightedEdge> minSpanningTree = new HashSe...
QuixBugs/QuixBugs/java_programs/MINIMUM_SPANNING_TREE.java
quixbugs-java_data_31
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class SQRT { public static double sqrt(double x, double epsilon) { double approx = x / 2d; while (Math.abs(x-approx...
QuixBugs/QuixBugs/java_programs/SQRT.java
quixbugs-java_data_32
package java_programs; import java.util.*; public class WeightedEdge implements Comparable<WeightedEdge>{ public Node node1; public Node node2; public int weight; public WeightedEdge () { node1 = null; node2 = null; weight = 0; } public WeightedEdge (Node node1, Node no...
QuixBugs/QuixBugs/java_programs/WeightedEdge.java
quixbugs-java_data_33
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class LIS { public static int lis(int[] arr) { Map<Integer,Integer> ends = new HashMap<Integer, Integer>(100); int l...
QuixBugs/QuixBugs/java_programs/LIS.java
quixbugs-java_data_34
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class TO_BASE { public static String to_base(int num, int b) { String result = ""; String alphabet = "0123456789ABC...
QuixBugs/QuixBugs/java_programs/TO_BASE.java
quixbugs-java_data_35
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class FLATTEN { public static Object flatten(Object arr) { if (arr instanceof ArrayList) { ArrayList narr = (Arr...
QuixBugs/QuixBugs/java_programs/FLATTEN.java
quixbugs-java_data_36
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class SUBSEQUENCES { public static ArrayList<ArrayList> subsequences(int a, int b, int k) { if (k == 0) { retur...
QuixBugs/QuixBugs/java_programs/SUBSEQUENCES.java
quixbugs-java_data_37
package java_programs; import java.util.*; //import com.google.guava.Lists; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class NEXT_PERMUTATION { public static ArrayList<Integer> next_permutation(ArrayList<Integer> perm...
QuixBugs/QuixBugs/java_programs/NEXT_PERMUTATION.java
quixbugs-java_data_38
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class POWERSET { public static ArrayList<ArrayList> powerset(ArrayList arr) { if (!arr.isEmpty()) { Object firs...
QuixBugs/QuixBugs/java_programs/POWERSET.java
quixbugs-java_data_39
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class BUCKETSORT { public static ArrayList<Integer> bucketsort(ArrayList<Integer> arr, int k) { ArrayList<Integer> counts =...
QuixBugs/QuixBugs/java_programs/BUCKETSORT.java
quixbugs-java_data_40
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class DETECT_CYCLE { public static boolean detect_cycle(Node node) { Node hare = node; Node tortoise = node; ...
QuixBugs/QuixBugs/java_programs/DETECT_CYCLE.java
quixbugs-java_data_41
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class FIND_FIRST_IN_SORTED { public static int find_first_in_sorted(int[] arr, int x) { int lo = 0; int hi = arr.l...
QuixBugs/QuixBugs/java_programs/FIND_FIRST_IN_SORTED.java
quixbugs-java_data_42
package java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class QUICKSORT { public static ArrayList<Integer> quicksort(ArrayList<Integer> arr) { if (arr.isEmpty()) { ret...
QuixBugs/QuixBugs/java_programs/QUICKSORT.java
quixbugs-java_data_43
package correct_java_programs; import java.util.*; import java.lang.Math.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class NEXT_PALINDROME { public static String next_palindrome(int[] digit_list) { int high_m...
QuixBugs/QuixBugs/correct_java_programs/NEXT_PALINDROME.java
quixbugs-java_data_44
package correct_java_programs; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class FIND_IN_SORTED { public static int binsearch(int[] arr, int x, int start, int end) { if (start == end) { return -1; ...
QuixBugs/QuixBugs/correct_java_programs/FIND_IN_SORTED.java
quixbugs-java_data_45
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class LEVENSHTEIN { public static int levenshtein(String source, String target) { if (source.isEmpty() || target.isE...
QuixBugs/QuixBugs/correct_java_programs/LEVENSHTEIN.java
quixbugs-java_data_46
package correct_java_programs; import java.util.*; import java.util.function.BinaryOperator; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class RPN_EVAL { public static Double rpn_eval(ArrayList tokens) { Map<St...
QuixBugs/QuixBugs/correct_java_programs/RPN_EVAL.java
quixbugs-java_data_47
package correct_java_programs; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class BITCOUNT { public static int bitcount(int n) { int count = 0; while (n != 0) { n = (n & (n - 1)); count++; } ...
QuixBugs/QuixBugs/correct_java_programs/BITCOUNT.java
quixbugs-java_data_48
package correct_java_programs; import java.util.*; import java.lang.Math.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author Angela Chen */ public class SHORTEST_PATH_LENGTHS { // Define Infinite as a large enough value. This value will be used ...
QuixBugs/QuixBugs/correct_java_programs/SHORTEST_PATH_LENGTHS.java
quixbugs-java_data_49
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class LONGEST_COMMON_SUBSEQUENCE { public static String longest_common_subsequence(String a, String b) { if (a.isEm...
QuixBugs/QuixBugs/correct_java_programs/LONGEST_COMMON_SUBSEQUENCE.java
quixbugs-java_data_50
package correct_java_programs; import java.util.*; import java_programs.Node; /** * * @author Angela Chen */ public class SHORTEST_PATH_LENGTH { public static int shortest_path_length(Map<List<Node>, Integer> length_by_edge, Node startnode, Node goalnode) { int n = length_by_edge.size(); // th...
QuixBugs/QuixBugs/correct_java_programs/SHORTEST_PATH_LENGTH.java
quixbugs-java_data_51
package correct_java_programs; import java.util.*; import java_programs.Node; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class REVERSE_LINKED_LIST { public static Node reverse_linked_list(Node node) { Node pr...
QuixBugs/QuixBugs/correct_java_programs/REVERSE_LINKED_LIST.java
quixbugs-java_data_52
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class LCS_LENGTH { public static Integer lcs_length(String s, String t) { // make a Counter // pair? no! ju...
QuixBugs/QuixBugs/correct_java_programs/LCS_LENGTH.java
quixbugs-java_data_53
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class PASCAL { public static ArrayList<ArrayList<Integer>> pascal(int n) { ArrayList<ArrayList<Integer>> rows = new...
QuixBugs/QuixBugs/correct_java_programs/PASCAL.java
quixbugs-java_data_54
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class IS_VALID_PARENTHESIZATION { public static Boolean is_valid_parenthesization(String parens) { int depth = 0; ...
QuixBugs/QuixBugs/correct_java_programs/IS_VALID_PARENTHESIZATION.java
quixbugs-java_data_55
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class MAX_SUBLIST_SUM { public static int max_sublist_sum(int[] arr) { int max_ending_here = 0; int max_so_...
QuixBugs/QuixBugs/correct_java_programs/MAX_SUBLIST_SUM.java
quixbugs-java_data_56
package correct_java_programs; import java.util.*; import java.lang.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class KNAPSACK { public static int knapsack(int capacity, int [][] items) { int weight = 0, val...
QuixBugs/QuixBugs/correct_java_programs/KNAPSACK.java
quixbugs-java_data_57
package correct_java_programs; import java.util.*; import java_programs.Node; public class TOPOLOGICAL_ORDERING { public static ArrayList<Node> topological_ordering (List<Node> directedGraph) { ArrayList<Node> orderedNodes = new ArrayList<Node>(); for (Node node : directedGraph) { if (...
QuixBugs/QuixBugs/correct_java_programs/TOPOLOGICAL_ORDERING.java
quixbugs-java_data_58
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class POSSIBLE_CHANGE { public static int possible_change(int[] coins, int total) { if (total == 0) { re...
QuixBugs/QuixBugs/correct_java_programs/POSSIBLE_CHANGE.java
quixbugs-java_data_59
package correct_java_programs; import java.util.*; import java.util.ArrayDeque; import java_programs.Node; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class BREADTH_FIRST_SEARCH { public static Set<Node> nodesvisited...
QuixBugs/QuixBugs/correct_java_programs/BREADTH_FIRST_SEARCH.java
quixbugs-java_data_60
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class HANOI { // default start=1, end=3 public static List<Pair<Integer,Integer>> hanoi(int height, int start, int end)...
QuixBugs/QuixBugs/correct_java_programs/HANOI.java
quixbugs-java_data_61
package correct_java_programs; import java.util.*; import java_programs.Node; import java_programs.WeightedEdge; import java.lang.Math.*; /** * * @author Angela Chen */ public class SHORTEST_PATHS { // Define Infinite as a large enough value. This value will be used // for vertices not connected to each ...
QuixBugs/QuixBugs/correct_java_programs/SHORTEST_PATHS.java
quixbugs-java_data_62
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class KTH { public static Integer kth(ArrayList<Integer> arr, int k) { int pivot = arr.get(0); ArrayList<In...
QuixBugs/QuixBugs/correct_java_programs/KTH.java
quixbugs-java_data_63
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class GCD { public static int gcd(int a, int b) { if (b == 0) { return a; } else { ...
QuixBugs/QuixBugs/correct_java_programs/GCD.java
quixbugs-java_data_64
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class SHUNTING_YARD { public static List shunting_yard(ArrayList tokens) { Map<String, Integer> precedence = new H...
QuixBugs/QuixBugs/correct_java_programs/SHUNTING_YARD.java
quixbugs-java_data_65
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class GET_FACTORS { public static ArrayList<Integer> get_factors(int n) { if (n == 1) { return new Arra...
QuixBugs/QuixBugs/correct_java_programs/GET_FACTORS.java
quixbugs-java_data_66
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java_programs.Node; /** * * @author derricklin */ public class DEPTH_FIRST_SEARCH { public static boolean depth_first_search(Node startnode, Node goalnod...
QuixBugs/QuixBugs/correct_java_programs/DEPTH_FIRST_SEARCH.java
quixbugs-java_data_67
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class MERGESORT { public static ArrayList<Integer> merge(ArrayList<Integer> left, ArrayList<Integer> right) { //System....
QuixBugs/QuixBugs/correct_java_programs/MERGESORT.java
quixbugs-java_data_68
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class KHEAPSORT { // import heapq // heap is data structure used for priority queue // pq O(log n) to pull off lowe...
QuixBugs/QuixBugs/correct_java_programs/KHEAPSORT.java
quixbugs-java_data_69
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class WRAP { public static void main(String[] args) { System.out.println("abc".lastIndexOf("c",30)); } pub...
QuixBugs/QuixBugs/correct_java_programs/WRAP.java
quixbugs-java_data_70
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class SIEVE { public static boolean all(ArrayList<Boolean> arr) { for (boolean value : arr) { if (!val...
QuixBugs/QuixBugs/correct_java_programs/SIEVE.java
quixbugs-java_data_71
package correct_java_programs; import java.util.*; import java_programs.Node; import java_programs.WeightedEdge; /** * Minimum spanning tree */ public class MINIMUM_SPANNING_TREE { public static Set<WeightedEdge> minimum_spanning_tree(List<WeightedEdge> weightedEdges) { Map<Node,Set<Node>> groupByNode = ...
QuixBugs/QuixBugs/correct_java_programs/MINIMUM_SPANNING_TREE.java
quixbugs-java_data_72
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class SQRT { public static double sqrt(double x, double epsilon) { double approx = x / 2d; while (Math.abs(...
QuixBugs/QuixBugs/correct_java_programs/SQRT.java
quixbugs-java_data_73
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class LIS { public static int lis(int[] arr) { Map<Integer,Integer> ends = new HashMap<Integer, Integer>(100); ...
QuixBugs/QuixBugs/correct_java_programs/LIS.java
quixbugs-java_data_74
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class TO_BASE { public static String to_base(int num, int b) { String result = ""; String alphabet = "01234...
QuixBugs/QuixBugs/correct_java_programs/TO_BASE.java
quixbugs-java_data_75
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class FLATTEN { public static Object flatten(Object arr) { if (arr instanceof ArrayList) { ArrayList na...
QuixBugs/QuixBugs/correct_java_programs/FLATTEN.java
quixbugs-java_data_76
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class SUBSEQUENCES { public static ArrayList<ArrayList> subsequences(int a, int b, int k) { if (k == 0) { ...
QuixBugs/QuixBugs/correct_java_programs/SUBSEQUENCES.java
quixbugs-java_data_77
package correct_java_programs; import java.util.*; //import com.google.guava.Lists; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class NEXT_PERMUTATION { public static ArrayList<Integer> next_permutation(ArrayList<Integ...
QuixBugs/QuixBugs/correct_java_programs/NEXT_PERMUTATION.java
quixbugs-java_data_78
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class POWERSET { public static ArrayList<ArrayList> powerset(ArrayList arr) { if (!arr.isEmpty()) { Ob...
QuixBugs/QuixBugs/correct_java_programs/POWERSET.java
quixbugs-java_data_79
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class BUCKETSORT { public static ArrayList<Integer> bucketsort(ArrayList<Integer> arr, int k) { ArrayList<Integer> ...
QuixBugs/QuixBugs/correct_java_programs/BUCKETSORT.java
quixbugs-java_data_80
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java_programs.Node; /** * * @author derricklin */ public class DETECT_CYCLE { public static boolean detect_cycle(Node node) { Node hare = node; ...
QuixBugs/QuixBugs/correct_java_programs/DETECT_CYCLE.java
quixbugs-java_data_81
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class FIND_FIRST_IN_SORTED { public static int find_first_in_sorted(int[] arr, int x) { int lo = 0; int hi...
QuixBugs/QuixBugs/correct_java_programs/FIND_FIRST_IN_SORTED.java
quixbugs-java_data_82
package correct_java_programs; import java.util.*; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ /** * * @author derricklin */ public class QUICKSORT { public static ArrayList<Integer> quicksort(ArrayList<Integer> arr) { if (arr.isEmpty()) { ...
QuixBugs/QuixBugs/correct_java_programs/QUICKSORT.java
README.md exists but content is empty.
Downloads last month
4