# Sorting

This document has very good examples for applying the ideas of O notation to various sorting algorithms. The only problem is that the sample code is in Java. Thankfully, there’s not much to change! You can easily convert the Java code provided into C++ by doing the following:

• Ignore public class Sort { and the matching }. That’s just some Java boilerplate.
• Ignore public static and private static. That’s just some Java boilerplate for defining functions.
• If you see int[] as a variable type, change it to int*.
• If you see arr.length, then pass the length of the array as an argument to the function as well and use that.
• Now we have converted this small subset of Java to C++ :D