You are not logged in. Please login at www.codechef.com to post your questions!

×

How to remember long codes...

How can we remember long codes that we write in C++....so that we can use it to solve another problems ?

asked 25 Jan '13, 23:31

praveen_kishor's gravatar image

1★praveen_kishor
40111313
accept rate: 0%


Remember the algorithms!!! And then just convert it to code, when you need it. :-)

link

answered 25 Jan '13, 23:33

tijoforyou's gravatar image

2★tijoforyou
4.2k52364
accept rate: 15%

Thanks sir...but for every problem is it necessary that there is an algorithm....and by algorithm how can we approach.....in coding competetions i saw a lot of codes large enough ( approx 200 line )....does the users type these much code themselves or copy paste will also work ?

(25 Jan '13, 23:36) praveen_kishor1★

For most problems, there is (atleast) one algorithm behind it.

By learning an algorithm, we just understand the working of the soln to a problem. For example, the bubble sort algorithm just swaps two adjacent data items, if they are out of order. This is continued, until there are no more out-of-order elements to swap. Armed with this idea, you can code this one in any language you choose, using the features available. You can also add your own little optimizations.

Once you learn algorithms, you will enjoy writing out hundreds (or probably thousands) of lines of code. :-)

(25 Jan '13, 23:53) tijoforyou2★

And learning algorithms also makes learning a few (or even more) data structures a necessity, which is in fact good for a programmer.

(25 Jan '13, 23:55) tijoforyou2★

Thanks sir.....what is the best way to learn algorithm.....i have corman book ....algorithms are theory .....so i just read and understand them.....any suggestion from you....how you have done algorithms and codings when u r beginner like me ?????

(25 Jan '13, 23:57) praveen_kishor1★

Constant practise. That is the only way you learn programming. Getting the theory is easy. But getting it into the code might need some thinking and work, which you get only through constant practise. And www.codechef.com is one of the best platform to learn. (This is where I did learn, when I began.)

(26 Jan '13, 00:18) tijoforyou2★

Well you dont need to learn codes, you dont even need to learn algorithms at first you must be heading to the basic questions....which are called adhoc these type of programming questions dont need any standard algorithm....they are basic/logic types. Actually i think just jumping to standard algorithms without having any prior programming experience is a destructive approach.

Also You can print out commonly used C++ functions and STL handbook so you dont have to remember those after some practice they will be inscribed in your head.

You can google more about adhoc questions.

link

answered 31 Aug '14, 22:49

semiconductor's gravatar image

2★semiconductor
1304
accept rate: 20%

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×1,916
×1,664
×1,490
×846
×148

question asked: 25 Jan '13, 23:31

question was seen: 1,931 times

last updated: 31 Aug '14, 22:49