4 ms·
Good point. Although we do introduce the long way first. The reason we don't use a,b = b,a in our code is that it isn't very portable to other languages. We w
by bnmnetp 12y ago
Good point. Although we do introduce the long way first.
The reason we don't use a,b = b,a in our code is that it isn't very portable to other languages. We wrote this book as a second semester textbook. So most students are not very good programmers and will be transitioning to something like Java or C++ in the next semester.
Further, for most of the sorting algorithms we have exercises where we suggest that users modify the code themselves to use simultaneous assignment.
- javafoo 12y agoCrawling your book, i stumble over several codes that use flags instead of "return" to exit, by example, you use two flags for searching on an ordered list. These kind of codes are not great for beginners because they tend to think that setting the flag is equivalent to exiting which is as you know an illusion.