Category Archives: Competitive Programming

Graph implementation using STL for competitive programming | Set 1 (DFS of Unweighted and Undirected)

We have introduced Graph basics in Graph and its representations. In this post, a different STL based representation is used that can be helpful to quickly implement graph using vectors. The implementation is for adjacency list representation of graph. Following is an example undirected and unweighted graph with 5 vertices. Below is adjacency list representation… Read More »

Formatted output in Java

Sometimes in Competitive programming, it is essential to print the output in a given specified format. Most users are familiar with printf function in C. Let us see discuss how we can format the output in Java: Formatting output using System.out.printf() This is the easiest of all methods as this is similar to printf in… Read More »

How to prepare for ACM – ICPC?

ACM ICPC(Association for Computing Machinery – International Collegiate Programming Contest) is a world-wide annual multi-tiered programming contest being organized for over thirteen years. The contest is sponsored by IBM. This article focuses on what all topics that are important for the competitive programming and should especially be studied in order to train yourself for upcoming… Read More »

Test Case Generation | Set 2 ( Random Characters, Strings and Arrays of Random Strings)

Set 1 (Random Numbers, Arrays and Matrices) Generating Random Characters Generating Random Strings Generating Array of Random Strings This article is contributed by Rachit Belweriar. If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks… Read More »