import Java.util.arraylist;import java.util.List; Public classStrtest { Public Static voidMain (string[] args) {//simulation generates a large integerLong n=Shengcheng (); //split this big integer to see what 's made of it.listsplitnumber (n); for(intI=0; I) {System. out. println (list.Get(i)); } } /** function: Calculates 2 of the whole number of times * Yellow Sea * Time: 2016-01-20 * @param n * @return*/ Private Static LongGetnumberby
rods in different ways, then cut into two parts is a variable amount, bad control.According to the above ideas, we can use two methods to try to solve this problem:recursion (Key code):/** * Optimal cutting scheme for calculating steel bars of length n (recursive) * @author Aaron * August 3, 2015 * /private static int Getmax (int[] p, int n) { System.out.println (n); if (n Memory Search (Key code):private static int[] Getrecordarray (int n) {if (n full Source code d
link Address: Commodity barcode (Jbarcode)This article is copyrighted by the author and the blog Park is shared, welcome reprint, but without the author's consent must retain this paragraph, and in the article page obvious location to the original linkOriginal link: http://www.cnblogs.com/yuchuan/p/JBarcode2.htmlIf you think this article is good, may wish to recommend, let more readers get the harvest.If you have any other ideas, may wish to leave a message, we all discuss together. Three peopl
4th Day-------------------------Transpose of the array:1, the precondition is that the two-dimensional array is a square, that is, n rows n columns./*** Transpose of two-dimensional data*/public class Arraytransdemo {public static void Main (String [] args) {String[][] arr = {{"A", "B", "C", "D", "E"},{"F", "G", "H", "I", "J"},{"K", "L", "M", "N", "O"},{"P", "Q", "R", "s", "T"},{"U", "V" "," W "," X "," Y "}};Print (arr);SYSTEM.OUT.PRINTLN ("---------
Merge sort idea: Sort an array into two parts (using recursion), then merge the results together, merging the last two ordered arrays into a larger ordered array.Time complexity o (n) = NlognThe most appealing nature of merge sorting is that it guarantees that the time required to sort an array of any length n is proportional to the nlogn, and the disadvantage is that the extra space required is proportional to n.Merge sort is also divided into top-down sorting and bottom-up sorting methods:The
[]temp =New int[Arr.length];//before sorting, build a temporary array of good one length equal to the original array length to avoid frequent space-opening in recursionSort (arr,0,arr.length-1, temp); } Private Static voidSortint[] arr,intLeftintRightint[]temp] { if(leftRight ) { intMid = (left+right)/2; Sort (arr,left,mid,temp);//left-hand sub-sequence ordered by merge orderSort (arr,mid+1,right,temp);//Right merge sort to make right sub sequence orderlyMerge (Arr,left,mid,
); SYSTEM.OUT.PRINTLN (path); } } Through this time of optimization, let me know the importance of the source code, want to know something in-depth, you need to understand the internal, with learning knowledge to arm themselves, rookie study, Big Bird do not spray, just record, by the way to those who do not love their brains, if you like me this way, please click on the lower right corner of the recommendation,Sleep, Xia
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.