One is the algorithm of 36 selected 7, implemented by the loop chain table in the data structure:
/ * Direct change M and N value should be able to achieve M selection N ability * is use 36 selection 35 should be no problem * I have not tested, and the code is a bit chaotic * master to change it. * /
Class myNumber = 0; MyNumber next = null; // Define two constants to solve 36 elections 7, as long as these two numbers can be arbitrarily selected, Final Static Int N = 7; // If the corresponding suggestion is not found after the corresponding suggestion // definition method PUBLIC MyNumber AddPoint () {MyNumber Temp = New MyNumber (); this.next = TEMP; TEMP.InTnumber = THIS .INTNumber 1; Temp.next = null; return temp;} // Create a circular chain, there are 36 nodes, the header node is Head public void createline (MyNumber Head) {MyNumber P = head; for (int i = 0 i Public class chosenumber {public static void main (String [] args) {mynumber head = new myNumber (); head.creatline (head); // Concrete Head.choosePoint (HEAD); // Cruise}} The other is to generate a new point, the technical content is not high, for reference only