What is the process for a normal student to start from very basic coding to high level coding so I that I can solve problems from CodeChef TopCoder etc?
-
I don't know any thing abt coding , Want to start coding from very basic level to high level so that I can solve problem from codechef , topcoder etc 1)which programming language should I start 2)tell me a book for that language which is very easy to understand and also it has few question to solve 3)give me some website were I can try medium level question 4) when should I start data structure 5) tell me a book for data structure which is very easy to understand 6) when should I start algorythm also tell me the book which is easy to understand. 7) when should I start attempting question or prqctise question on top coder etc. 8) I want yo be excellent coder please guide me as there is no one in my college who is interested in coding , even professors are not good Thank you
-
Answer:
start with c and learn some programming techniques with c...then go for "PYTHON " my favourite language and you don't need to care about data types and range while solving problems if you gonna use PYTHON...after all start learning an algorithm for a day and try to read the topcoder tutorials which will be useful...GEEKSFORGEEKS will introduce you some algorithms and learn them after making yourself strong in DS... before going into codechef try some easy SPOJ problems in this order /problems/classical/sort=-6,start=0(append this to the spoj url)and try the problems in this order... Happy Coding...!!!
Vijay Kumar at Quora Visit the source
Other answers
If there's one tip I can give you after four years of experience (and failures!) is that you must practice, pratice and practice even more! Focus on being a great programmer rather than just on codechef. This will help you not only achieve success in codechef, but alsoo open a wide variety of options to choose your field in the future since with time your preferences might change. Luckily enough though, learning is become easier day by day through MOOCs (Massive Open Online Courses). You can learn a hell lot more than an average programmer if you pursue online courses besides your college syllabus. I found two really awesome websites for this purpose http://edx.org http://coursera.org I personally did a course named CS50 from Harvardx via http://edx.org. Not only did i learn a lot about programming, from the basics, i also learnt how much there is more to programming than just writing code that does XYZ task. Trust me, its easy at first, and picks up speed so fast, you'll be amazed you could learn so much, so fast. Plus an advantage considering I'm in India, the course really adds weight to my resume, which is often valued by a lot of Indian companies in placements. A lot of courses on such sites are free too. With certifications from top universities of the world. And if you pursue an online course you'll always have a challenge to complete. Leading universities have found that mind is like a muscle, so the more the exercise it, the stronger/smarter it becomes. And it's also a common phenomena that you tend to retain more information if you learn through audio-visual content - hence the stress on awesomeness of MOOCs. And other than these, google and github are your best friends when it comes to learning online. Other than that, here's a few things that could come in handy if you wanna learn anything and everything! If you think I didn't exactly answer a lot of your questions, that's because there's no good absolute answer to such a question. Just keep calm, keep learning and keep exploring and I'm sure you'll discover what's best for you since blindly following a single book or a language can only get you so far. Hope this is helpful :)
Surdeep Singh
Patience is the key. 1) Which programming language should I start? If want to be a top notch competitive programmer, learn C++ http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list 2) Resources for C++ If you are impatient then read "Sam'S Teach Yourself C++ In 24 Hours" first. Must read "C++ Primer". Please go through the following links:- http://community.topcoder.com/tc?module=Static&d1=features&d2=020807 3) When should I learn DS and Algorithms? Hmm... you need to implement data structures in order to learn them. Once you are comfortable with a programming language, go for DS. http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/video-lectures/ Related book:- CLRS (initially skip mathematical proofs) Topcoder:- http://www.topcoder.com/tc?d1=tutorials&d2=alg_index&module=Static http://www.geeksforgeeks.org/fundamentals-of-algorithms/ 4) When should I start attempting question or practice question on top coder? Best way to learn new things is to try them. Once you get a grip on basic data structures, start solving problems on SPOJ and topcoder. Solve 1-2 problems daily. Please go through my following answers on quora:- 5) I want to be excellent coder Yes you can but you need to practice hard. There's no substitute for hard-work. Thanks for A2A. I wish you luck on your journey. PS:- I think it will take around 100 hours to get started and solving easy questions on online judges. Set smaller goals and achieve them, one step at a time my friend. Dedicate 3-6 months to see the results.
Mitesh Pathak
Start with C/C++, These were my first languages. Some people would suggest Python, but i think C/C++ have a vaguely similar syntax with some other common languages like javascript or C# when compared with Python. So learning 'c' would help in learning those languages later. Anyway learning C/C++ also makes learning Python easier too. For learning C, I would suggest this book: http://it-ebooks.info/book/704/ Of Course just reading it isn't going to be enough. You would have to start practicing programming along with the book. Try Hackerrank's warmup questions on algorithms to get started and consequently move to harder and harder questions. https://www.hackerrank.com/domains You could similarly try out questions on codechef with a higher accuracy rate to get started. Once you have knowledge about simple algorithms, recursion etc. then you can learn about Datastructures and Algorithms. Practice makes perfect. Good luck.
Midhun Darvin
A very descriptive doc i found: link : https://docs.google.com/document/d/10pw2WJDECopU3JgvZ6DEFQ8flBgNGw9f7SWmR2gYP_w/edit?usp=sharing Contents : You will need to show motivation. Languages that should be used C/C++/JAVA (your choice) We will focus on C++, JAVA is slow (one big advantage of JAVA is Big Integers, we will see later) C++ is like superset of C with some additional tools. So, basically if you have knowledge of C, you are ready to code in C++ as well. Otherwise go back and learn how to write codes in C/C++. Sometimes knowledge of PYTHON is helpful when you really need big integers. PARTICIPATE PARTICIPATE PARTICIPATE (the only mantra) http://www.spoj.com/problems: Its a problem Archive (recommended for all beginners) Start with problems having maximum submissions. Solve first few problems (may be 20). Build some confidence. Then start following some good coders (check their initial submissions). Then start solving problems topic wise. Never get stuck for too long in the initial period. Google out your doubts and try to sort them out or you can discuss with someone (ONLY IN THE BEGINNING). Before getting into live contests likehttp://www.codeforces.com/ orhttp://www.codechef.com/, make sure that you have solved about 50-70 problems on SPOJ. http://www.codechef.com/: Do all the three contests every month. Do participate in CodeChef LunchTime for sure. Even if you are unable to solve a problem do always look at the editorials and then code it and get it accepted (this is the way you will learn). And even if you are able to do it, do look at the codes of some good coders. See how they have implemented. Again you will learn. Same point apply to TopCoder and Codeforces as well. http://www.codeforces.com/: 4 to 5 short contests of 2 hour in a month (Do them once you develop some confidence). http://community.topcoder.com/tc: Once you have proper experience and you can write codes very fast. Online Programming Contests You write codes and submit them online . The judge runs your code and checks the output of your program for several inputs and gives the result based on your programâs outputs.You must follow exact I/O formats. For example, do not print statements like : âplease enter a numberâ, etc :P Each problem has constraints : Properly analyse the constraints before you start coding. Time Limit in seconds (gives you an insight of what is the order of solution it expects) -> order analysis(discussed later). The constraints on input ( very imp ): Most of the time you can correctly guess the order of the solution by analysing the input constraints and time limit . Memory Limit ( You need not bother unless you are using insanely large amount of memory). Types of errors you may encounter apart from wrong answer : Run Time Error (Most Encountered) Segmentation fault ( accessing an illegal memory address) You declared array of smaller size than required or you are trying to access negative indices . Declaration of an array of HUGE HUGE(more than 10^8 ints) size -_- . Dividing by Zero / Taking modulo with zero :O . USE gdb ( will learn in coming lectures ) Compilation error You need to learn how to code in C++. USE GNU G++ compiler or http://ideone.com/(be careful to make codes private). Time Limit Exceeded You program failed to generate all output within given time limit. Input Files are not randomly generated , they are made such that wrong code does not pass. Always think of worst cases before you start coding .Always try to avoid TLE. Sometimes a little optimizations are required and sometimes you really need a totally new and efficient algorithm (this you will learn with time). So whenever you are in doubt that your code will pass or not .Most of the time it wonât pass . Again do proper order analysis of your solution . Wrong Answer [most encountered] Wrong answer means that the output given by your program did not match the correct output for that input (or did not fulfill the conditions in case multiple solutions were possible). This is the most frequently occurring bug that you will face and getting rid of it can be a pain. First of all you must check that your program gives correct output for the sample test cases, exactly satisfying the output format. Read your code completely once before testing. This way you will be able to remove any obvious bugs. Check for incorrect variable initializations / uncleared memory, etc. These errors can also occur when you copy paste code. In case you keep getting wrong answer even after you have tried to find the bug in your program you must rethink upon you algorithms and prove it if you havenât done so.If you find bug in your algorithm start working on new algorithm. Now its time for some serious debugging.Modulate your code, that means if I have to first generate a graph and then apply shortest path on it, I check first if the graph has been generated correctly. Some speed can be traded for accuracy, with practice you will learn to write accurate programs faster. If you have already proven your algorithm then try to generate some test cases and check it against you program. Case 1: Your program fails for you own inputs but you donât understand how. Try to put a lot of print/cout statements for all important variable and check at each step that they are changing as it was desired.Most probably you will find the bug. Case 2: You program passes for you hand made test case but still gives WA on judge. Now there are two possible scenarios . Your algorithm is wrong or you program fails at tricky test cases like overflow or corner cases etcs. Assuming that you have already proven you algorithm you now need to find those corner test case.For this write a generator file which will generate a lot of test cases.And write a brute force solution which you must be 100% sure that it give correct output.Now match the output of these two codes ( donât use large test cases if your brute force is too slow ).As you don't have time limit condition for your machine your brute force can be slow.Check for which test case the answer differs then again go to case 1 with this test case. Other Points: Sometimes when you are stuck . Check the running time of other accepted codes to take an insight like what Order of solution other people are writing / what amount of memory they are using. 4 MB ~ array of size 10^6 . Or 2-d array of size 10^3*10^3 Standard Memory limits are of Order of 256MB. You cannot allocate more than 4 MB space inside a function (it gives segmentation fault). Thus if you have to make an array of size >= 10^6 , make it global or use dynamic memory allocation. Order analysis : Order of a program is a function dependent on the algorithm you code. We wont go in theoretical details just think Order of program as the total number of steps that program will take to generate output generally a function based on input like O(n^2), O(n) or O(log n) . Suppose you write a program to add N numbers .See the following code. int curr,sum=0; for(int i=0;i<n;i++) { scanf(â%dâ,&curr); sum = sum+curr; } Total number of computations = n*(1+1+1+1) n times checking i<n. n times i++ n times scanf n times + operating So total of 4*N. We remove the constant and call it O(N) This is the simplest I can explain.You will get further understanding with practice and learning. You must know running time of these algorithms (MUST) Binary Search -> ? Merge / Quick sort -> ? Searching an element in sorted/unsorted array -> ? HCF / LCM / Factorization / Prime CHeck ? We all know the computation power of a processor is also limited. Assume 1 sec ~ 10^8 operations per second . (for spoj old server it is 4*10^6). Keep this in mind while solving any problem. If your program takes O(n^2) steps and problems has T test cases . Then total order is T*N^2. For T < 100 and N < 1000 . It will pass . But for T < 1000 and N < 1000 it wont . Neither for T < 10 and N < 10000 . INT OVERFLOW : Sum three numbers. Constraints : 0 < a,b,c < 10^9 int main() { int a , b,c; scanf(â%d %d %dâ,&a,&b,&c); int ans = a + b + c; printf(â%dâ,ans); return 0; } This program won't give correct output for all cases as 3*10^9 cannot be stored in INTS you need long long int or unsigned int (4*10^9). what if 0<a,b,c < 10^1000 ? Comparing Doubles : int main() { float a ; scanf(â%fâ,&a); if(a == 10 ) printf(âYESâ); return 0; } float / double donât have infinite precision . BEWARE ( 6/15 digit precision for them respectively). Use a margin of EPS ( ~ 0.0000001 ) in comparing. Ex - if ( abs( a - 10 ) < EPS ) printf(âYES\nâ); Lets do the following problem. http://www.spoj.com/problems/GAMES/ (discussed) Standard Template Library (STL): In your code sometimes you need some data structures and some functions which are used quite frequently. They already have lots of standard functions and data structures implemented within itself which we can use directly. Data Structures ( To be discussed in later lectures ) Vectors Stack Queue / Priority_queue (heap) Map Set Functions Sort Reverse GCD Swap permutation binary search (left + right) max , min pow , powl (find out the difference) memset Now imagine writing codes using these inbuilt functions and data structures . It would be much more simpler now. What headers/libraries should you include ? Basically the above functions / DS are in different libraries So in some cases you may need to include many headers . But you can include everything using just one header.Ignore headers and #defineâs in other coders codes for now. #include <bits/stdc++.h> Try the following problem : http://www.codechef.com/problems/ANUUND Which of the above inbuilt function did you use ? What if we have to sort an Array of structure ? You can either make a struct and write compare function for it.(Read more at http://cplusplus.com) Or you can use an vector of pair Read This: http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=sorting Now you are ready to start competitive programming . You can continue reading this doc or get started on your own . Good luck :) First, you must learn the basic and well known algorithms . Not only algorithm but you must also understand why that works , proof , code it and analyze it . To know what basic algorithms you must know you can read here(Advice make a quora account if donât have one). Also read these answers on how to start competitive programming and get good at it. Topcoder has very nice tutorials on some topics here http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=alg_index. You must also read this book topic wise to understand an algorithm in more broader way http://ldc.usb.ve/~xiomara/ci2525/ALG_3rd.pdf. [Introduction to Algorithms By Cormen] To get good at writing fast codes and improving your implementation follow this: My personal advice is to start practicing on topcoder . Start with Div2 250 master it then start with Div2 500 master it then move to Div1 250 .Also read the editorials of problem you solve and the codes of fastest submissions to learn how to implement codes in simple and elegant way.Meanwhile keep learning algorithms and keep practicing them on SPOJ or Codechef or Codeforces . And do read the tutorials, after a time you will realize that the tricks and methods to solve are repeating themselves . We learn from practice http://only.In the beginning you will feel that every problem uses a different algorithm,How can anyone learn so much but I assure you after a time the logics/algorithms will start to repeat and after some time you will be able to solve problems using those algorithms in actual contests. Below are few topics to start with and problems related to those topic. They are very basic stuffs and you can learn all you need to know by just googling. âWhen i will get some time I will try to update and give more details about the topics a newbie should cover.â Try to do all the problems stated below if you are a beginner. PRIMES Prime Check ( O(log n) also possible read about miller-rabbin ) Factorization Number of factors Sum of factors Generating Primes using sieve of eratosthenes Bounds on number of primes till N Eulerâs totient function Practice Problems : http://www.spoj.com/problems/NDIV/ http://codeforces.com/problemset/problem/431/B http://www.spoj.com/problems/GAMES/ http://www.spoj.com/problems/GCJ101BB/ http://www.spoj.com/problems/GCJ1C09A/ http://www.spoj.com/problems/MAIN72/ http://www.spoj.com/problems/WINDVANE/ http://www.spoj.com/problems/NDIV/ http://www.spoj.com/problems/PTIME/ http://www.spoj.com/problems/NDIVPHI/ http://www.spoj.com/problems/NOSQ/ http://www.spoj.com/problems/AFS/ http://www.codechef.com/MAY13/problems/WITMATH/ http://www.spoj.com/problems/CUBEFR/ Try as many as you can. Other things that you can read meanwhile Euler Totient function and Euler's theorem [[ READ ]] Modulo function and its properties Miller-Rabin Algorithm [[ READ ]] Extended Euclid's Algorithm [[ READ ]] Keep exploring STL Prove running time of HCF is O(log n) Try sorting of structures Practice few problems on several Online Judges Try to do + - * operations on large numbers(<1000 digits) using char array (for learning implementation) Number of factors and sum of factors in sqrt(n) time ,Number of primes till N Go through these tutorials (The listed problems might be tough but do read the tutorial) http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=primalityTesting http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=combinatorics http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=math_for_topcoders http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=primeNumbers Basic Number Theory Modulo operations and Inverse modulo How to compute a ^ b % p in O(log b), where p is prime Find Nth fibonacci number modulo p [Read Matrix exponentiation] n! % p ( what if we have lots of test cases and n<10^6 and P is fixed) ETF ( calculation / calculation using sieve / properties ) [[ read http://en.wikipedia.org/wiki/Euler's_totient_function]] Euler theorem , Fermatâs little theorem , Wilson theorem [[ READ ]] nCr % p (inverse modulo) ( read about extended euclid algorithm) (p-1)! % p for prime p (read wilsonâs theorem), Use of fermat theorem in Miller-Rabin ( Probabilistic ) ( http://miller-rabin.appspot.com ) 64 Choose 32 < 10^19 we can precompute till herein a 2 dimensional array [Learn use of the recursive relation : (n+1)Cr = nCr + nC(r-1)] Number of ways to traverse in 2D matrix[Catalan Number] ( what if some places are blocked ? Hint : DP) a^b % c . Given Hcf(a,c) = 1 .And what if Hcf(a,c) ! = 1. [[ READ Chinese Remainder Theorem, not used much in competition]] Matrix Exponentiation solving linear recurrence using matrix exponentiation(like fibonacci) Practice problems: http://www.spoj.com/problems/DCEPC11B http://www.codechef.com/MAY13/problems/FTRIP/ http://www.spoj.com/problems/FIBOSUM/ http://www.spoj.com/problems/POWPOW/ http://www.spoj.com/problems/POWPOW2 [[ CRT ]] Power of BITS Numbers are stored as binary bits in the memory so bits manipulation are alway faster. Bitwise or operator : | Bitwise and operator : & Bitwise xor operator : ^ Bitwise left shift : << Bitwise right shift : >> Memset and its uses using function : sizeof() Bitmask and use of Bitmask in Dynamic Programming [[subset DP]] Some cool Tricks n = n * 2 :: n = n << 1 n = n /2 :: n = n >> 1 checking if n is power of 2 (1,2,4,8â¦) ::checking !(n & (n-1)) if x is max power of 2 dividing n, then x = (n & -n) Total number of bits which are set in n = __builtin_popcount(n) setting xth bit of n :: n |= (1<<x) checking if xth bit of n is set :: checking if n&(1<<x) is non zero Problem : You are given N numbers and a numbers S. Check if there exist some subset of the given numbers which sums equal to S .What if you are asked to compute the number of such subsets ? Practice : http://www.spoj.com/problems/SPCO/ http://codeforces.com/problemset/problem/114/B http://www.spoj.com/problems/CLEANRBT/ More will be added later Read this for further knowledge http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=bitManipulation Binary Search : Try this : http://codeforces.com/problemset/problem/431/D Understand the concept of binary search. Both left_binary_search and right_binary_search. Try to implement it on your own. Look at others implementation. sample implementation : int l = 0, r = 10000, key_val = SOME_VALUE, m; while (r - l > 1) { m = (l+r) >> 1; int val = some_non_decreasing_function(m); if(val < key_val) l = m; else r = m; } if (some_non_decreasing_function(l) == key_val ) return l; else return r; // this can be modified in a variety of ways, as required in the problem Practice Problems: http://www.spoj.com/problems/AGGRCOW/ http://codeforces.com/problemset/problem/431/D [[Learnât something new ?]] http://www.spoj.com/problems/PIE/ http://www.spoj.com/problems/TETRA/ http://www.spoj.com/problems/KOPC12A/ The Beauty of Standard Template Library of C++ Vectors in one dimension and two dimension http://www.codechef.com/MAY14/problems/CHEFBM solve : http://www.codechef.com/MAY14/problems/COMPILER Now use stacks to taste its beauty and solve the following problem too. http://codeforces.com/problemset/problem/344/D Queue http://www.spoj.com/problems/DONALDO/ Priority Queue http://codeforces.com/gym/100247/problem/I [[First try without using Priority queue]] Set http://www.spoj.com/problems/FACEFRND/ [[First try without using set ]] What if I tell you that apart from scanning the input this problem can be done in 2 lines ? Interesting ? Think! Map http://www.codechef.com/MARCH13/problems/TOTR/ http://codeforces.com/gym/100247/problem/C http://www.spoj.com/problems/SETSTACK/ [[map, set, set_intersection / union]] Some Practice Problems Before you proceed further http://www.spoj.com/problems/DCEPC11B/ http://www.spoj.com/problems/AGGRCOW/ http://www.codechef.com/problems/CHEFBM http://www.codechef.com/JUNE13/problems/PERMUTE http://www.spoj.com/problems/KOPC12A/ (recommended) http://www.codechef.com/MAY13/problems/WITMATHhttp://www.codechef.com/MAY13/problems/WITMATH/ (recommended) http://codeforces.com/problemset/problem/431/D (recommended) http://www.spoj.com/problems/SPCO/ http://www.spoj.com/problems/FIBOSUM/ http://www.spoj.com/problems/SPCO/(recommended) http://www.codechef.com/AUG13/problems/CNTSOLS/ http://www.spoj.com/problems/IOPC_14F/ http://www.spoj.com/problems/NDIVPHI/(recommended) http://www.spoj.com/problems/NDIVPHI/(easy) http://www.spoj.com/problems/NDIVPHI/(easy) http://codeforces.com/problemset/problem/114/B (easy) http://www.spoj.com/problems/HISTOGRA/ [[http://blog.csdn.net/arbuckle/article/details/710988 : use stacks]] http://www.spoj.com/problems/HOMO/ http://www.spoj.com/problems/NGM2/ http://www.spoj.com/problems/RENT/ [[ recommended ]] GRAPHS Try the following problems : http://www.spoj.com/problems/PPATH/ http://www.spoj.com/problems/CAM5/ Any Ideas ? Def : Think graphs as a relation between node , related nodes are connected via edge. How to store a graph ? ( space complexity ) Adjacency Matrix ( useful in dense graph) using 2-D array of bool/ints. Adjacency List (useful in sparse graph) O(min(deg(v),deg(u))) using vector of ints. You must know the following terminologies regarding Graphs : Neighbours Node Edge Degree of vertices Directed Graph Connected Graph Undirected Graph Connected components Articulation Points Articulation Bridges Tree [[ connected graph with N nodes and N-1 edges]] Leaves Children Parent Ancestor Rooted Tree Binary Tree K-ary Tree Cycle in graph Path Walk Directed Acyclic Graph [[ DAG ]] Topological Sorting (Not very important, in my opinion) Bipartite Graph ( Tree is an example of Bipartite Graph . Interesting Isnât it.) Breadth First Search/Traversal (BFS) [[ very important, master it as soon as possible]] Application : Shortest path in unweighted graphs Depth First Search/Traversal (DFS) [[very very important, master it as soon as possible]] Infinitely many applications, just kidding :P (But Its true, Indeed !) Now try the problems given at the beginning ! Practice Problems : http://www.codechef.com/JUNE14/problems/DIGJUMP http://www.spoj.com/problems/PRATA/ http://www.spoj.com/problems/ONEZERO/ http://www.spoj.com/problems/PPATH/ http://www.spoj.com/problems/PARADOX/ http://www.spoj.com/problems/HERDING/ http://www.spoj.com/problems/PT07Z/ http://www.spoj.com/problems/NICEBTRE/ http://www.spoj.com/problems/CERC07K/ http://www.spoj.com/problems/BUGLIFE/ http://www.spoj.com/problems/COMCB/ http://www.spoj.com/problems/NAKANJ/ http://www.codechef.com/IOPC2013/problems/IOPC13N/ http://www.codechef.com/IOPC2013/problems/IOPC13G/ http://www.codechef.com/IOPC2013/problems/IOPC13C/ Problem : You are given a Graph. Find the number of connected components in the Graph. Hint : DFS or BFS. Problem : You are given a grid with few cells blocked and others open. You are given a cell , call is source, and another cell , call it dest. You can move from some cell u to some another cell v if cell v is open and it is adjacent to cell u. You have to find the shortest path from source to dest. Hint : Try to think the grid as a Graph and apply some shortest path algorithm. Which one ? You think ! Problem : You are given a Tree. You need to find two vertices u and v such that distance between them maximum. [[http://www.spoj.com/problems/PT07Z/]] Hint : Try to do it in O(1) number of DFS or BFS ! GREEDY ALGORITHMS Greedy Algorithms are one of the most intuitive algorithms. Whenever we see a problem we first try to apply some greedy strategy to get the answer(we humans are greedy, arenât we :P ? ). Read http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=greedyAlg tutorial for further insight or you can directly attempt the problems most of the greedy approaches are quite simple and easy to understand/formulate.But many times the proving part might be difficult. But you should always try to prove your greedy approach because most the times it happens that you later realise that you solution does not give the optimal answer. http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=greedyAlg They are generally used in optimization problems and there exists an optimal substructure to the problem and solutions are generally O(n log n) (sorting) or O(n) (single pass). Problems List: http://www.spoj.com/problems/BAISED/ http://www.spoj.com/problems/BALIFE/ http://www.spoj.com/problems/GCJ101BB/ http://www.codechef.com/problems/FGFS http://www.codechef.com/problems/KNPSK http://www.codechef.com/problems/LEMUSIC http://www.spoj.com/problems/ARRANGE/ http://www.spoj.com/problems/FASHION/ Q)A thief breaks into a shop and finds there are N items weight of ith item is Wi and cost of ith item is Ci and thief has a bag of which can carry at most W units of weight. Obviously thief wants to have maximum profit . What strategy he should choose if : Case 1: If he is allowed to take fractional part of items (like assume item to be a bag of rice and you can take whatever fraction of rice you want). [Hint :: greedy]) Case 2:If he cannot break the items in fractional parts. Will now greedy work ? Try to make some test cases for which greedy will fail. Most of time when greedy fails its the problem can be solved by Dynamic Programming(DP). DYNAMIC PROGRAMMING [[ DP ]] In my view this is one the most important topic in competitive programming. The problems are simple and easy to code but hard to master. Practice as many DP problems as much possible. You must go through http://community.topcoder.com/tc?module=Static&d1=tutorials&d2=dynProg topcoder tutorial and you must try to solve all the problems listed below in this doc. ( These are basic problems and some with few variations that we feel one should know. You must practice other DP problems too) Problems list: http://www.spoj.com/problems/COINS/ Read about http://en.wikipedia.org/wiki/Maximum_subarray_problem [I dint find exact question on any online judge as its very very basic] http://www.codechef.com/problems/DELISH http://www.codechef.com/problems/KSUBSUM/ Q)Finding NCR [Using above discussed recursion in math section and DP] https://projecteuler.net/problem=18 Q)Given a matrix filled with numbers.You are initially at upper left corner , you have to reach to the lower right http://corner.In each step you can either go right or down.When ever you go to a cell you points increase by value of that cell.What is the maximim possible points you can gain? http://www.codechef.com/JUNE13/problems/LEMOUSE http://www.spoj.com/problems/MAXWOODS/ http://www.spoj.com/problems/EDIST/ http://www.spoj.com/problems/ADFRUITS/ http://www.spoj.com/problems/IOIPALIN/ http://www.codechef.com/problems/PPTEST/ http://www.codechef.com/problems/MAXPR http://www.codechef.com/problems/LEBALONS http://www.codechef.com/problems/DBOY/ http://www.codechef.com/problems/HAREJUMP For further advanced topics you can follow topcoder tutorials. This also might be helpful http://web.stanford.edu/class/cs97si/. Good Luck !!! Practice Hard !! Regards Abhilash Kumar Triveni Mahatha Co-ordinators @ https://www.facebook.com/groups/pclubiitk/
Paras Rautela
Thanks for A2A. Answers in sequence. 1) You can start with C,C++,Python. All are more or less equally good and have their own pros and cons. Personally, I would suggest you beginning with C. (Rest of the answers will be given in the context to C) 2)Start with reading first 5 chapters of Yashwant Kanetkar. Once you are familiar immediately switch to 'The C Programming Language' by Dennis Ritchie. 3)Start trying the warm up question of http://Hackerrank.com . 4)Once you are done with Dennis Ritchie, you can anytime start data structure. 5)For algorithm purpose : Data Structure(Schaum Series) For programming purpose: Data structure by Tanenbaum 6)Along with data structure you can also start Algorithms. Book for Algorithm: Introduction to algorithm by Cormen 7)Anytime when you feel comfortable with programming and you think now you have started thinking in programming language and you are more logical now. If you can't solve question, don't get dishearten. Review your concepts. Study more algorithms. Think more logically. Try again. Try try till you succeed. 8)Keep following good sites like http://stackexchange.com , http://geeksforgeeks.org and some good blogs on programming.
Sarthak Deshwal
I suggest you learn C++, because it provides lot of features to develop your coding skills by practicing day by day. Some helpful websites are http://www.cplusplus.com http://www.cprogramming.com and also you can develop Algorithm and data structure skills here www.http://www.geeksforgeeks.comorg Then i suggest to solve problems on spoj website by clicking below link... http://vhttp://www.spoj.com/problems/classical/sort=6
Pandurangarao Mudedla
1. Programming Language to start with. I started with C as it is the most basic and easy to learn programming language. 2. Books: Just start a little bit with Yashwant Kanetkar. But as soon as you hold a grip of the language switch to Kernighan and Ritchie. 3. At first, practice questions from Kernighan and Ritchie only. 4. Then start doing easy problems at Codechef, Hackerrank and Codeforces to get acquainted with competitive programming. 5. Side by side start doing Data structures from Tennenbaum or Schaum Series or from any of the online sources. Also start practicing competitive questions on Data Structures. 6. After practicing these for sometime, start doing some Algorithms which you encounter in various contests. You can also read Cormen for Algorithms. 7. Finally practice questions on each and every topic you learn. http://discuss.codechef.com/questions/48877/data-structures-and-algorithms See this link for various Algorithms and Data structures.
Akhil Kumar
You should start with Python as a programming language. Oreily learning python is a good book to start with or you can find other books in http://resrc.io http://Codechef.comis a good place to find easy and mid level problems. Data sturctures when you have played enough with the basics and can solve easy level and condirion oriented problems in a jiffy.(Or when you have good hold of pointers if you are starting with C/C++)
Sarang Khajuria
Step 1 - Choose a programming language.C++ or Java would be a good choice. Step 2 - Get the standard books for the choosen language and learn the basics and try to write simple programs and execute.Remember starting from books is very important. Step 3 - Learn data structure and algorithms by taking online courses from different universities.Coursera and mitocw and many more are available. Now u r ready to go.
Pankaj Doley
Related Q & A:
- What is it like being a British student in America?Best solution by Ask.com old
- What are some jobs I can get without a high school diploma?Best solution by Yahoo! Answers
- What is a high paid job that i can get with an undergraduate degree in accountancy?Best solution by undergraduatedegree.org
- Is java or visual basic a machine level, low level, high level or binary level programming language?Best solution by Quora
- What is the different between low level language and high level language in a computer programing?
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.