Posts

Practice Guidance For Competitive Programming – Competitive Programming Series Part-3

Practice Guidance For Competitive Programming – Competitive Programming Series Part-3 If you haven’t read the first two parts of this series, you can read them from below posts. This part will lead you with the next step in your programming journey. This is the part where you actually start practicing problem-solving, competitive programming style. The following is the way I have found to be the most effective. 1. spoj.com The first step in your competitive programming practice, for it to be the most effective, choose these two websites. SPOJ is the best and the leading forerunner in terms of programming contest style questions. Their online judge is awesome. SPOJ engine is also used by CodeChef. The way to practice problems is this. You have to sort the problems in descending order of number of users who solved a problem. If it helps, here is the link for that – http://www.spoj.com/problems/classical/sort=6 – bookmark it. Also, go and check out ProjectEuler. Cr

Competitive programming part-2

Problem Solving Using Algorithms and Data Structures – Competitive Programming Part-2 This part will deal with the next step in your journey – starting to solve problems using data structures and algorithms. There are many ways to do this. I have personally found going through a few things very apt in this process. This part will give you a step by step guidance. Once you have started learning algorithms and data structures, do it this way for the most effective experience. Learn algorithms according to a category, like sorting, searching, stacks, queues, etc,. Geeks For Geeks: Once you learn the data structure/algorithms in a particular category, head over to  Geeks For Geeks – Data Structure Problems . Solve all the problems in the category of data structures/algorithms that you have learned. Say, you learn all about stacks, stack operations. You then head over to geeksforgeeks and solve all the problems listed under stack. Before seeing the solution given below

No idea how to start CP journey? Here you go!

Programming And Algorithms Basics – Competitive Programming Series – Part1 The first step you take venturing into the world of competitive programming is to learn programming – programming language(s), their constructs, logic, basic problem-solving and algorithmic approach to the same. This part will give you the essential guidance for accomplishing all of the above. I) Programming Languages: The very first thing you need to learn is a programming language. People talk to each other using a language. If you are a native English speaker living in America, you probably communicate to your friends, fellow human beings in English. But, when we need to communicate with a computer, we can’t use the every-day English. That’s where a programming language comes in. So, which programming language do I choose to start with? There are so many programming languages one can start with. Nothing beats C Programming though. Why C Programming? As a college student, we are all taught C Pro

Exact String Matching Algorithms

Image
Preliminary Definitions A string is a sequence of characters. In our model we are going to represent a string as a 0-indexed array. So a string S = ”Galois” is indeed an array [‘G’, ’a’, ’l’, ’o’, ’i’, ’s’]. The number of characters of a string is called its length and is denoted by |S|. If we want to reference the character of the string at position i, we will use S[i]. A substring is a sequence of consecutive contiguous elements of a string, we will denote the substring starting at i and ending at j of string S by S[i...j]. A prefix of a string S is a substring that starts at position 0, and a suffix a substring that ends at |S|-1. A proper prefix of a S is a prefix that is different to S. Similarly, a proper suffix of S is a suffix that is different to S. The + operator will represent string concatenation. Example: S = "Galois" | S |= 6 S [ 0 ]= 'G' , S [ 1 ]= 'a' , S [ 2 ]= 'l' ,..., S [ 5 ]= 's' S [ 1. .. 4 ]= &