-
Notifications
You must be signed in to change notification settings - Fork 28
Expand file tree
/
Copy pathArrays and Collections Classes
More file actions
19 lines (14 loc) · 948 Bytes
/
Arrays and Collections Classes
File metadata and controls
19 lines (14 loc) · 948 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Question:
Time Complexity of Arrays.sort() and Collections.sort() "STATIC" methods
NOTE: Arrays and Collections (BOTH with s) are classes in Java
Arrays is class in util package,
Collections is class of util package,
Collection is interface of util package
VERY VERY IMP NOTE: PLURAL (i.e. Arrays and Collections) are CLASSES
whereas SINGULAR form (e.g. Collection) is INTERFACE
IMP NOTE: There is no such thing as "Array" in Java. "Arrays" exist BUT "Array" does NOT exist.
Arrays - Class (http://docs.oracle.com/javase/7/docs/api/java/util/Arrays.html)
Collection - INTERFACE (http://docs.oracle.com/javase/7/docs/api/java/util/Collection.html)
Collections - Class (http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html)
Source: http://stackoverflow.com/questions/4254122/what-is-the-time-complexity-of-this-sort-method?rq=1
Solution: The time complexity of this predefined method of Arrays class and Collections class is nlgn