Programming And Algorithms Basics – Competitive Programming Series – Part-1

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 Programming to begin with. The first reason for that is C Programming being a procedural language. It’s easy to learn. Education wise, people believe that if you are able to learn C programming, you can learn any other language in a relatively lesser time compared to how much you take for learning C language.

So, first learn programming in C.


The following resources are those I found best helpful in the process of learning C.

1.The C Programming Language by Dennis Ritchie

This is the most comprehensive book ever written for the C programming language. It is written by Dennis Ritchie and it is easily the best book I have read on C. When you start and stick with this book until the book’s end (it’s like 200 pages or so) – it will set you up with all the knowledge that you’ll need to get started on your journey to becoming a kickass programmer.

Once you complete the book mentioned above, you will find that you are strong in theory, but you still have to start applying. The book mentioned above makes you very strong theoretically, but doesn’t give you actual programming experience. The following books will compensate for that.

2. Let Us C

This book by Yashwant Kanetkar is the most pragmatic book available for C. If you go through this book completely and complete all the exercises, learn the concepts given with those examples, you will become really proficient in C programming. This book will come handy when you want to learn programming in a practical manner. It also covers all the basics in such a way that you will find it easy to go from topic to topic without much difficulty in the transition.

3. Test Your C Skills

This is a valuable addition to the list of books you can study and learn a great deal from. Once you complete the first two books, you can test your knowledge of C programming with this book. This is a really valuable book that will take you a long way in understanding the minute details of the most overlooked concepts in C programming. If you are preparing for interviews, this book will help you a lot when companies test your knowledge of C programming (pointers, structures, function pointers & some more advanced concepts).


Most of us end up learning C++ right after we learn C. That is usually because C++ is the best language that you can get started with learning object-oriented programming. Functional programming languages are mostly obsolete in terms of their mainstream usage factor.

The following books are the ones I found to be amazing in terms of learning C++

1. For Beginners:-

Following are the best books for beginners. I will put the best 3 books here. Go and read the reviews, and pick the one that you feel like you could stick with.

a) Programming: Principles and Practice Using C (2nd Edition)

This book is written by the creator of C++ – Bjarne Stroustrup. This is easily one of the best beginner books available for C++. He teaches you how to program using C++ as a tool. You learn programming and object-oriented concepts with C++ as the tool through which you achieve that. When you complete this book, you will be very well versed in OOP concepts, programming using OO concepts, and you will have a significant idea of what to pursue further. For your purpose, the next part of this series will deal with that.

b) C Primer (5th Edition)

This is the most appreciated beginner-intermediate level book for C++. Has the most comprehensive tutorial for all your needs related to C++.

c) Accelerated C : Practical Programming by Example  and  Thinking in C : Introduction to Standard C , Volume One (2nd Edition) (Vol 1)

Both of these books are really good ones. They assume that you have significant programming knowledge. They also have a steep learning curve. These two books will prepare you for most difficult concepts in C++ through a series of lessons of increasing difficulty.

My personal suggestion:

Object Oriented Programming with C

This book is the best one I have personally used for C++. It’s amazing in the way that the author assumes that the reader has zero programming experience. He takes you through a series of chapters which is very easy to read and understand. Every concept has a related program attached to it, which you will find very easy to go through, understand, and work out. He provides very practical everyday examples in his programs that you feel at ease with those programs, learning how they work by relating it to that particular application.

2. Intermediate and Advanced level:

If you want to take competitive programming seriously, let me tell you this. C++ is the most widely used language in competitive programming. One reason is that it is the fastest of all available languages with which you can participate in programming contests. The most cited reason is the usage of macros (which you will learn quite soon in your C++ journey.

So, assuming that you are really serious about this – the following books will take you a really long way in becoming a pro coder in C++.

a) The C Programming Language, 4th Edition

This is probably the only book you will need in your journey to master C++. Written by its creator, this book has everything you need to learn – most importantly about templates, standard template library, and most of the advanced topics that will help you so much in your competitive programming journey.

b) The C Standard Library: A Tutorial and Reference (2nd Edition)

This is a very good book and will be the best accompaniment to the book I have mentioned above. These two books together will serve you greatly in your gaining knowledge of advanced C++ techniques, topics, and will also serve as a standard go-to reference for you.

This is a long process. But, to learn the most needed concepts for competitive coding, it won’t take more than 3 to 4 months of dedicated practice. You can either choose to learn Java after you are confident in C++ or you can keep progressing with C++.

For those who want to learn Java, the following resources will best serve your interests.


The following books are the best ones. You can pick any one of them and start right ahead.

1. A combination of Head First Java, 2nd Edition and SCJP Sun Certified Programmer for Java 6 Exam 310-065

These two are the books that I personally used. They are amazing, nothing short of awesome. While Headfirst Java book makes learning java fun, SCJP book helps you learn the nitty gritty of core java. SCJP book will give you the essential knowledge to the minutest detail. These two books are the best bet.

2. Introduction to Programming in Java : An Interdisciplinary Approach

This book is a bridge between intermediate level java and data structures & algorithms. This book assumes that you have the very basic knowledge of Java programming. Yet, you will find that they start from the basics. This book has a steep learning curve with real time examples, near perfect code examples for every concept. If you are serious of taking up Java, this book will give you an edge compared to the other books that you choose to start with.

II) Data Structures & Algorithms:

Once you are really good in a programming language of your choice, preferably an object-oriented programming language, you will find that you can’t do anything with just a programming language. You will use that programming language as a tool for solving some problems. Any problem, in order to be solved, requires a stepwise solution. That solution is called an algorithm. To efficiently solve the problem with respect to space & time efficiency, you will also use certain data structures to make the solution scalable to large data input. To be able to do all this, you need to learn data structures and algorithms. The books I have mentioned here will get you started. But it is regular consistent practice that will take you far in the world of programming. Regular and consistent improvement and practice is the key.

The following books are the industry standard textbooks that are the most widely used books for learning Data Structures and Algorithms.

1. Introduction to Algorithms, 3rd Edition

This book is the most widely used – the most recommended book – fondly called as CLRS book for Algorithms.

As much as I’d like to recommend this book, if you are a beginner, this book will do more harm than good. As a beginner, I was scared of this book. This book is very abstract. The book requires a some prior stint with programming & basic algorithmic application experience for you to comprehend it the best.

You can use this book as a reference. But when you enter competitive coding related practice, this book will take you farther than any other book will. The reason is that this book covers advanced topics in a significant light, with much more emphasis. Also, you get to learn some pretty advanced topics in data structures and algorithms that the other standard books have not covered.

So, a tip for you? For the first two to three months from when you start learning data structures – algorithms, use this book only for reference if you need extra explanation, advanced knowledge. Once you are confident about understanding, interpreting algorithms in any form, start using this book more. You will often find yourself going back to this book for some advanced knowledge, and problem solving related techniques.

2. Algorithms in C , Parts 1-4: Fundamentals, Data Structure, Sorting, Searching, Third Edition and Algorithms in C Part 5: Graph Algorithms (3rd Edition) (Pt.5)

These two books are the best I have found, for C++. There are many other books for learning data structures and algorithms with respect to C++. But these two books by Robert Sedgewick of Coursera’s Algorithms course fame, a Princeton University instructor, beats every other book out of the water.

3. Algorithms (4th Edition)

This is the best book for those who prefer Java, to learn Data structures and algorithms. I learned everything I know from this book only. This book has an accompanying website where the complete code, solutions, data, and other errata are published along with some basic reference.

Covering from the basic sorting algorithms to advanced data structure like Tries, this book is the best to have if you are an interested java programmer intending to get into competitive programming. This book again is written by Robert Sedgewick. This is the accompaniment for the Coursera’s Algorithms course (Part 1 & 2). The best of all the books available for java, this one gives you comprehensive knowledge of algorithms, complexity, scalability, and the essential statistical knowledge of the algorithms. Reading and completing this book with all its exercises will take you a long way in mastering the basic data structures and algorithms. It will also teach you the most important skill needed for competitive programming – scaling algorithms.

With this, I conclude this part of the series. Follow the guidance and the books given in this part closely, probably for a year or so before you feel very confident with the basics of programming, writing programs, converting algorithms into programs in your preferred programming language and your knowledge of the language constructs.

Once you have done this, you can move on to the next part of this series. The next part will guide you to get started with problem-solving. Solving problems with programming, data structures, and algorithms is the main reason why we have to setup the base that you are guided to do, in this first part.


If you have any suggestions, and any improvements that you think I could do to this article, please do let me know in the comments section below. I will make sure I’ll include your input in this post. I want this series to be helpful to as many people as possible and I have written it in a way that seemed the best fit. If you think that this can be improved, probably some more resources and some more steps can be added to the guidance – I’d be happy to take your inputs and include them where they fit in.

Also, you can check out the Part – 2 of the series.

Loading Facebook Comments ...


  1. says

    Hey, great article. I have heard that CLRS is the bible for Algorithms, but the book is intimidating. To mitigate this dread first timers have, Thomas Cormen himself recommends his book “Algorithms Unlocked” before moving to CLRS. Hope this is helpful.

    • herculesphaeton says

      Yes, I read that reply of his in Quora. He has recommended that book – and it’s his own book, a tad bit less known. But I guess that’s useful too. I will include your suggestion into the post ASAP. Also, yes, the CLRS book is intimidating for a complete beginner. So, my advice will always be to keep away from it until one feels confident and comfy enough with dsa.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>