Important algorithms I have learnt at university
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
1. simple-cases
2. data-structures
3. paradigms
4. graphs
5. math
.gitignore
README.md

README.md

Algorithm-Library

Library of all the algorithms implemented in C++/Java that I have encountered. Some of the code examples here are taken from the "Competitive Programming 3" book.

I'm still writing most of this, and it's still under development. I will be adding more and more algorithms as I learn more things.

Areas Already Organized

  • Simple built-in features
  • Data Structures

C++

  • Use printf scanf instead of cin cout for a speedup.
  • Use the algorithm::sort as it runs in O(nlogn), and it is cache friendly.
  • For Bit manipulation use built-in integer data types, and if not enough use bitset rather than vector.

Java

  • Use BufferedReader, and PrintWriter.
  • ArrayList is faster than Vector.
  • ASCII: BufferedReader in = new BufferedReader(new InputStreamReader(System.in, ”ISO−8859−1”));

Optimizations

To run C++ faster you can use tags like:

g++ -std=c++11 -O3 filename.cpp

This will run the third optimization level of g++.

-O3

-O3 is only appropriate when trying to generate fast code though - use it with caution.

-Ofast

-Ofast would also work: -Ofast enables all -O3 optimizations. It also enables optimizations that are not valid for all standard compliant programs.