Skip to content

Category Archives: Competitive Programming

Python is an amazingly user-friendly language with the only flaw of being slow. In comparison to C, C++, and Java, it is quite slower. Online… Read More
In Competitive Programming, most of the time we need to enter input for checking our code manually. But it would become cumbersome if we have… Read More
First of all you need to know about Template, Macros and Vectors before moving on the next phase! Templates are the foundation of generic programming,… Read More
Prerequisite: Introduction and DFSThe task is to find LCA of two given nodes in a tree (not necessarily a Binary Tree). In previous posts, we… Read More
There is been always a case that a wrong answer gives too much pain rather than TLE (Time Limit Exceed), as in former you couldn’t… Read More
Sqrt (or Square Root) Decomposition Technique is one of the most common query optimization technique used by competitive programmers. This technique helps us to reduce… Read More
In Set 1, unweighted graph is discussed. In this post, weighted graph representation using STL is discussed. The implementation is for adjacency list representation of… Read More
Many programmers always argue that the problems in Competitive Programming always end up with TLE(Time Limit Exceed). The main problem of this error is that… Read More
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… Read More
In previous posts, we have discussed how to calculate the Lowest Common Ancestor (LCA) for a binary tree and a binary search tree (this, this… Read More
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.… Read More
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… Read More
Google Asia Pacific University Test, also referred to as Google APAC, is perhaps the best opportunity for a student enrolled in higher education institutes in… Read More
Prerequisites : BIT, DFS Given a rooted tree T, with ‘n’ nodes, each node has a color denoted by the array color[](color[i] denotes the color… Read More
Generating Random Sorted Arrays We store the random array elements in an array and then sort it and print it. // A C++ Program to… Read More