Live data from Hacker News

Teen Mathletes Do Battle at Algorithm Olympics

wired.com

1–10 of 35 posts

Re: Teen Mathletes Do Battle at Algorithm Olympics

#4

How to become matheletes like them ? Any guides ? Books? Where to get started ? You suggest to learn python by it clearly says C,C++ and Pascal. Should I learn C++ as first language ? Help ?

Ask for opinions of 10 HNers and get 10! answers ...

Personal opinion only ...

Learn Python first. Work on problems from Project Euler. Learn to program Python in OO mode. Learn C. Learn C++. Learn to program Python in functional mode. Read about the algorithms mentioned in the article. Understand P vs NP. Understand why this is funny: http://xkcd.com/287/

Re: Teen Mathletes Do Battle at Algorithm Olympics

#5

How to become matheletes like them ? Any guides ? Books? Where to get started ? You suggest to learn python by it clearly says C,C++ and Pascal. Should I learn C++ as first language ? Help ?

Like any sport, you should have a good coach - informatics is no different. I used to participate in such competitions in high school and I can tell you that reading books is not enough. There has to be someone to teach you the basics so you can build on that. I started very early with Logo, moved to Pascal and finally graduated to C++. In the end, most of the problems can be solved with a standard algorithm - e.g. graph theory (DFS, flow, etc), dynamic programming (Knapsack), geometry (finding intersections or area of polygons). Some problems require heuristic solutions, but that is very rare. You need a lot of experience and that is gained by solving problems. You can find a lot of online judges that have problem sets from very easy to difficult - e.g. http://acm.zju.edu.cn/onlinejudge/showProblemsets.do or http://uva.onlinejudge.org/index.php?option=com_onlinejudge&...

Re: Teen Mathletes Do Battle at Algorithm Olympics

#6

How to become matheletes like them ? Any guides ? Books? Where to get started ? You suggest to learn python by it clearly says C,C++ and Pascal. Should I learn C++ as first language ? Help ?

Ask for opinions of 10 HNers and get 10! answers ... Personal opinion only ... Learn Python first. Work on problems from Project Euler. Learn to program Python in OO mode. Learn C. Learn C++. Learn to program Python in functional mode. Read about the algorithms mentioned in the article. Understand P vs NP. Understand why this is funny: http://xkcd.com/287/

I have to disagree. I participated in few algorithm competition (however much easier than IOI) and I think that: - OOP - C - functional python are redundant. Creating more advanced objects than graph vertex/edge is usually unnecessary in algorithm tasks. Functional programming - well, that would be useful sometimes, but as IOI and most similiar type competirions support C/C++/Pascal, you won't be able to use it anyway. Problems from project euler seems to be a good start, however. Learning mentioned in article algorithms too.

Re: Teen Mathletes Do Battle at Algorithm Olympics

#7

How to become matheletes like them ? Any guides ? Books? Where to get started ? You suggest to learn python by it clearly says C,C++ and Pascal. Should I learn C++ as first language ? Help ?

Language isn't important. You start by solving some problems in whatever language you know.

http://acm.timus.ru/Default.aspx?locale=en -- not a bad place to start

Good books include monographies about algorithms. In Russia, the most popular books on the subject are:

    * Introduction to Algorithms (Cormen)
    * Algorithms and Data Structures (Wirth)
    * Algorithms [in C++] (Sedgewick)
Don Knuth also has remarkable works but they're somewhat more into proofs and math.

Re: Teen Mathletes Do Battle at Algorithm Olympics

#8

How to become matheletes like them ? Any guides ? Books? Where to get started ? You suggest to learn python by it clearly says C,C++ and Pascal. Should I learn C++ as first language ? Help ?

I went to a school that was very supportive and often send multiple people to those and similar competitions. (I was quite active in the mathematics olympiades, and helped out with organizing them after I finished school.)

That approach is probably not suitable for you. Like lini said, having a mentor or coach or just a mate is a good idea. You can ask on HN or on irc, I guess you will find people to help you.

Re: Teen Mathletes Do Battle at Algorithm Olympics

#9
post #6

Earlier quoted context omitted.

Ask for opinions of 10 HNers and get 10! answers ... Personal opinion only ... Learn Python first. Work on problems from Project Euler. Learn to program Python in OO mode. Learn C. Learn C++. Learn to program Python in functional mode. Read about the algorithms mentioned in the article. Understand P vs NP. Understand why this is funny: http://xkcd.com/287/

I have to disagree. I participated in few algorithm competition (however much easier than IOI) and I think that: - OOP - C - functional python are redundant. Creating more advanced objects than graph vertex/edge is usually unnecessary in algorithm tasks. Functional programming - well, that would be useful sometimes, but as IOI and most similiar type competirions support C/C++/Pascal, you won't be able to use it anywa…

If I want to play Rachmaninov's second piano concerto, I don't start by trying to play it straight away. I start with simple pieces, with scales and arpeggios, and with speed exercises. I build my basics, initially leaving out things that I'm not ready for.

I think learning Python first, and then the concepts behind both OOP and FP, better prepare someone for solving problems in languages like C++ than trying to start with C++ first.

As I said, personal opinion.

ADDED IN EDIT:

Fascinating. Rather than refuting the point I'm trying to make, someone has simply down-voted it without comment. That's a shame, as it doesn't provide me the opportunity to learn. Perhaps I simply haven't been clear, or perhaps they simply disagree without caring to articulate their point.

To try to be more specific, I think that learning Python, then learning Python in an OO style, then learning C++, makes a better programmer faster than trying to learn C++ directly. I have no evidence, only anecdotes, and they're not worth much. I think it's like trying to make a 6 inch reflector telescope. It's faster to make a 4 inch, then a 6 inch, than it is to try to make a 6 inch first. Again, there have been no controlled, double-blind experiments, but it is the conventional wisdom.

So there it is. If you think that expressing such a thought is detracting from the value of HN then feel free to downvote this comment further. If you disagree, but think it's an interesting point that deserves to be refuted, I'd love to hear your reasons.

Re: Teen Mathletes Do Battle at Algorithm Olympics

#10

How to become matheletes like them ? Any guides ? Books? Where to get started ? You suggest to learn python by it clearly says C,C++ and Pascal. Should I learn C++ as first language ? Help ?

Well, python is nice, but must algorithm competition (for reasons i dont really know) allow only C/C++/Pascal. Learning C++ seems to be the best choice here (though I don't like it), as usually you are allowed to use standard template library which comes with a few useful structs/algorithms.

I have taken part in similar competition (but not world class, though), and my advice is:

- learn c++ so you can express basic algorithms - creating an algorithm which solves task and not having enough time/skills to code it is extremely frustrating. However don't spend too much time learning the language - you probably won't need to write your own templates or do some advanced OOP stuff. learning python is ok too (personally I like python much more than C++) - it is really easy and cool, but you won't be allowed to use it anyway

- learn some maths, you will need it. You wont need arithetics or calculus - rather combinatorics or some number theory. Try to choose 'tricky' tasks rather than that requiring much computation - in IOI you are the one who thinks about tricks, and computer does the computation ;)

- read about algorithms mentioned in texts. learn about: dynamic programming (knapsack problem), greedy algorithms, trees and graphs (dfs, bfs, dijskstra, maximum flow, minimal spanning tree (kruskal-prim)), data structures (start with lists and binary search trees, then move to queues more advanced like interval trees - there are lots of interesting, both trivial and complicated structures), text algorithms (KMP, Manacher algorithm), computational geometry (sweep line algorithm, convex hull). - also, learning some tools - like good editor and debugger (vim and gdb) and some basic linux command line knowledge (e.g. when you test your programs it's better to redirect input from file than to write it each time manually) is really handy - it will make coding/debuggins much easier

It seems that there is quite a lot to learn - if you are a newbie to algorihtms, at the beginning I recommend learning what is algorihtm complexity - sorting algorithms are good place to start here. Then spend a while with basic data structs (writing your own linked list is an obligatory exercise here), then move to something different. Dont try to learn everything at once, rather focus on single subject at given momment. Personally I learned algorithms from 'Introduction to algorithms' by Cormen/Rivest/Leierson/Stein - I did only a few chapters on graphs/geometry/data structs but it was hard, I didn't understand most of the math - however many people I knew who were good at algorithms gained some kind of intuition whether something works or not or what complexity it has(obviously, you dont have time to write a proof of your algorithm during competition - also, it isn't necessary) and didn't use it too much - anyway it's good to grasp basics (so you can e.g. estimate complexity bounds to your solution). Also don't start algorithms by trying to copypaste them from your book to editor - try to understand them first (pen and paper are your friends here). However it is good to code at least once each of well known algorihtms as an exercise.

I mentioned cormen earlier - however this book is tough. Some of the algorithm tutorials on topcoder site (http://www.topcoder.com/tc?d1=tutorials&d2=alg_index&#38...) may be useful for you - topcoder seems also as a good place to start coding (however, imho many tasks in div2 are rather brute-force, requiring much time coding than a good idea). Participating in your national OI may is a good idea too - usually you can find some useful resources on its site.

Post reply on HN