public class Recursive extends Object
Constructor and Description |
---|
Recursive() |
Modifier and Type | Method and Description |
---|---|
static int |
canEscapeMaze(char[][] rawMaze)
Problem 8: Maze solver.
|
static boolean |
canFlowOffMap(int[][] map,
int row,
int col)
Problem 6: Determine if water at a given point
on a map can flow off the map.
|
static void |
drawCarpet(int size,
int limit)
Problem 5: Draw a Sierpinski Carpet.
|
static String |
getBinary(int n)
Problem 1: convert a base 10 int to binary recursively.
|
static ArrayList<String> |
listMnemonics(String number)
Problem 4: Find all combinations of mnemonics
for the given number.
pre: number != null, number.length() > 0, all characters in number are digits post: see tips section of assignment handout |
static int |
minDifference(int numTeams,
int[] abilities)
Problem 7: Find the minimum difference possible between teams
based on ability scores.
|
static int |
nextIsDouble(int[] data)
Problem 3: Returns the number of elements in data
that are followed directly by value that is
double that element.
|
static String |
revString(String stringToRev)
Problem 2: reverse a String recursively.
pre: stringToRev != null post: returns a String that is the reverse of stringToRev |
public static int canEscapeMaze(char[][] rawMaze)
rawMaze
- represents the maze we want to escape.
rawMaze is not altered as a result of this method.public static boolean canFlowOffMap(int[][] map, int row, int col)
map
- The elevations of a section of a map.row
- The starting row of a drop of water.col
- The starting column of a drop of water.public static void drawCarpet(int size, int limit)
size
- the size in pixels of the windowlimit
- the smallest size of a square in the carpet.public static String getBinary(int n)
n
- the base 10 int to convert to base 2public static ArrayList<String> listMnemonics(String number)
number
- The number to find mnemonics forpublic static int minDifference(int numTeams, int[] abilities)
numTeams
- the number of teams to form.
Every team must have at least one memberabilities
- the ability scores of the people to distributepublic static int nextIsDouble(int[] data)
data
- The array to search.public static String revString(String stringToRev)
stringToRev
- the String to reverse.