## 03 November 2004

### srm 215 & 216 lessons

• 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.