7

I know that python's implementation of sorting (timsort) is implemented in C to get better performance. Is that also the case for the java implementation, or are all java algorithms implemented in java?

Cœur
  • 37,241
  • 25
  • 195
  • 267
sighol
  • 2,678
  • 6
  • 28
  • 34
  • Have a look at the source code to find it out (it's in a ZIP file in your JDK dir). (or wait a minute for someone to post the answer) – Bart Kiers Nov 24 '11 at 09:04

5 Answers5

7

The majority of the standard library is typically implemented in Java. That said, a lot of OS or platform specific functionality has to be implemented in "native" code, so a good percentage is also typically written in C and/or C++. It does depend a bit on the particular JVM implementation, of course.

Typical functionality implemented in languages other than Java includes threading, network I/O, file I/O, and the low-level UI API. Note that these are all pretty low-level, specific features though - the more abstract/general algorithms are ideally suited to implementation in Java, and therefore typically are.

Mac
  • 14,615
  • 9
  • 62
  • 80
5

Most of the Java library is implemented in Java, including the sort algorithm

unbeli
  • 29,501
  • 5
  • 55
  • 57
1

The answer is, it depends on the actual JVM implementation and the type of the algorithm. Most of the public stadard API alogrithms are in java. One exception for sure is thread scheduling.

zeller
  • 4,904
  • 2
  • 22
  • 40
1

As far as I know, they are implemented in Java. Here you can find some information about it.

oopbase
  • 11,157
  • 12
  • 40
  • 59
1

If you take a look at the java.util.Arrays.sort() sources, you can see that the sorting algorithm is implemented in Java. However this doesn't neccessarily imply, that all other algorithms are as well.

Roland Schneider
  • 3,615
  • 3
  • 32
  • 43