how it going to make difference in following case ------------------------------------------ i=0; switch(i) { case 1: //some operation case 0:// some operation } ------------------------------------------ i=0; if(i==1) { //some operation; } else if (i==0) { //Some operation } ------------------------------------------ even compiler implement jump table like below
key address 1 xxxxx 0 yyyyy Then two condition (worst case) need to be checked which is same as if else if Please correct me if i am wrong On Nov 21, 6:35 pm, "MOHIT ...." <mohit...@gmail.com> wrote: > for switch in the worst case compiler will generate if else chain .. else it > uses binary decision tree or jump table for optimization at compile time . -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.