Hacker News new | past | comments | ask | show | jobs | submit login

I am not sure where your cynicism or contempt is coming from. There is not much to a deeper understanding of xor-swap. If one knows the xor truth table one knows why it works, and knowing the truth table is essentially an act of memorization. I hope they are exposed to digital logic way before 3rd year. On the other hand cases where this will not work in the current form, perhaps needs a somewhat deeper understanding of bit lay out. Say if one were to swap two unicode characters from void * pointers to them.



My cynicism (not contempt - I know that the students are under various sorts of pressures) stems from personal experience.

It's not much good explaining how simple it is to understand the xor-swap - it doesn't change the fact that the majority of engineering students go to the link like the one I posted, compile a list of questions and answers, and rattle off answers before the question is even completed in the interviews.

It's like knowing [any interesting method] can be used to accomplish a task, without knowing why said method works.

edit: I realise all this is OT, but I was downvoted for my earlier post and felt the need to defend it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: