vishalkr07 / snippets

Concise algorithms and data structures

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is this?

This is a collection of algorithms and data structures I use in programming contests.

The goal of every snippet is to be short, simple, performant, and easy to copy-paste into other programs whenever needed.

Note that the code is not necessarily pedantic nor easy to understand. Common good programming practices are intentionally violated. Global variables, misuse of namespaces, inconsistent variable names, weird hacks, etc. are all over the place, and that's OK.

What is included?

Strings:

Graphs:

Math:

Other:

How to use?

All snippets assume that you have the following predefined:

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

typedef long long llint;

Just copy-paste any snippet in your code and follow instructions in comments.

Are these implementations correct?

Yes, they're very likely to be.

All snippets were tested in solutions to multiple programming problems, and used as a reference in two ACM-ICPC world finals.

Can I use these snippets in my code?

Yes, I don't mind.

Just make sure you understand the rules of competitions you participate in. Sometimes they require solutions to be fully written by yourself.

About

Concise algorithms and data structures

License:The Unlicense


Languages

Language:C++ 100.0%