algorithm - How can I do this recursive search in java? -
import java.util.*; import java.io.*; import java.io.chararrayreader; public class program2 { public static void main(string[] args) { try { string filename = args[0]; //reads command line argument 1 filename scanner file = new scanner(new file(filename)); //reads filename program,and opens analysis file.usedelimiter(system.getproperty("line.seperator")); arraylist<string> list = new arraylist<>(); //creates array list store chars transfer reading file while (file.hasnext()){ list.add(file.next()); } file.close(); char[][] array1 = new char[10][20]; (int =0; < list.size(); i++){ array1[i] = list.get(i).tochararray(); } } catch (filenotfoundexception e){ system.out.println("file not found: " + e.getmessage() );//catches , sends out error message } } static int charsearch(char[][] array1, char a, char b, char c){ (int =0 ; < array1.length; i++){ (int j =0; j < array1.length; j++){ while (a == 'a'){ return 1; hi all, have make program reads in file 10x20 grid. grid has letters a, b, c. chars, in random order. need do, find searching algorithm checks "groupings" of these letters.
much smaller version:
aabbacca ccabacba ccaaaabb aaaacccc so see how there 3 c groups, 2 b groups, , 3 groups? (the groups can touching horizontally or vertically, not diagonally.)
i have count that. tried it, can seen on bottom. also, wanted make sure rest of code makes sense , won't pfft on me.
thank :)
Comments
Post a Comment