srm 215 & 216 lessons
- "Know your libraries" (leadhyena_inran)
- To split a string into words in C++ you can do
while (is >> word)
since there is an implicit conversion from input streams to void*
.
- The STL has nice algorithms and utilities like
set_union
, copy
, inserter
, back_inserter
. It is not enough to know about them: you have to recognize opportunities to use them.
- Debug methodically
- Never panic for lack of time. If time is short then don't rush: do it by the book.
- Make it repeatable. Investigate your data structures. Try different input data and try to infer the cause.
- Use sanity checks when you have redundant information in the data structures (Knuth).
- Print the content of the DS.
- Construct additional information and print it. For example if you are counting ways to build a spanning tree then actually build the spanning trees and print them. The same goes for counting anything.
No comments:
Post a Comment
Note: (1) You need to have third-party cookies enabled in order to comment on Blogger. (2) Better to copy your comment before hitting publish/preview. Blogger sometimes eats comments on the first try, but the second works. Crazy Blogger.