The question is Why is processing a sorted array faster than an unsorted array? I got this question from mitbbs, it's a interview question. 在下面这个程序中,如果sort后的totalTime 总是比不sort的totalTime 小, process(a[i]); } } Now for the sake of argument, suppose this is back in the 1800s - before long distance or radio communication. You are the operator of a junction and you hear a train coming. You have no idea which way it will go. You stop the train to ask the captain which direction he wants. And then you set the switch appropriately.
Read full article from break the build: Branch Prediction
No comments:
Post a Comment