Master Engineering with Fun Quizzes & Brain Teasers!
Computational Complexity of K-Means 1 point possible (graded) Remember that the K-Means algorithm is given by 1. Randomly select 21, ...,2K 2. Iterate 1. Given zi,... ZK, assign each x(i) to the closest zj, so that Cost (21, ...ZK) min, || 216) ; || 2. Given C1,...,CK find the best representatives 21,..., 2K, i.e. find 21,..., ZK such that = Liec; , 1 C; Assuming that there are n data points {{1,..., 2n}, K clusters and representatives, and each x; {21,..., In} is a vector of dimension d, what is the computational complexity for one complete iteration of the k-means algorithm? That is, find the time (or the number of steps) it takes to complete steps 2.1 and 2.2. Note on Big-O notation Show O(m) OnK) O(nK) (ndK) Computational Complexity of K-Medoids 2 points possible (graded) Remember that the K-Medoids algorithm is given by 1. Randomly select 21,...,2K 2. Iterate 1. Given zi,... ZK, assign each x(i) to the closest zj, so that Cost (21,...ZK) min dist (z (6),zj) -1 1- 1,..., 2. Given C; {C1, ...,Ck} find the best representative z; {21, ...,In} such that dist (zl), z;) 20) eC is minimal. What is the complexity of step 2.1? O(n) (nk) O(nK) O(nd) Now what is the complexity of step 2.2? OndK) O(nK?) O(nKPd) O(ndK)
problem description and given info write (define) a public static method named countinlist, that takes two arguments that are both an arraylist of integer. this method must return a count (int) of the number of values in the first argument arraylist that are also in the second argument arraylist. for example: given an arraylist named list1 that contains this list of values: {1, 2, 1, 3, 2, 5, 6, 2, 4} and an arraylist named list2 that contains this list of values: {1, 2, 3} countinlist(list1, list2) should return 6 (because there are six values in list1 that are also in list2) given an arraylist named list1 that contains this list of values: {1, 2, 1, 3, 2, 5, 6, 2, 4} and an arraylist named list2 that contains this list of values: {2, 4} countinlist(list1, list2) should return 4 (because there are 4 values in list1 that are also in list2) given an arraylist named list1 that contains this list of values: {1, 2, 1, 3, 2, 5, 6, 2, 4} and an arraylist named list2 that contains this list of values: {7, 8, 9} countinlist(list1, list2) should return 0 (because there are 0 values in list1 that are also in list2) you may wish to write some additional code to test your method.