Tag: time-complexity

Time complexity of these 2 program

问题内容: I am new to complexity analysis. The task is that given a non-empty string like “Code” return a string like “CCoCodCode”. I have these 2 programs which are doing the same thing. Program 1: public String stringSplosion(String str) { String result = ""; for (int i=0; i<str.length(); i++) { for(int j=0;j<=i;j++) result += str.charAt(j);