Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

java - Radix Sort, the value of r -


please refer following code radix sort:

class radixsort {     public static void radix_sort_uint(int[] a, int bits)     {          int[] b = new int[a.length];         int[] b_orig = b;           int rshift = 0;         (int mask = ~(-1 << bits); mask != 0; mask <<= bits, rshift += bits) {              int[] cntarray = new int[1 << bits];              (int p = 0; p < a.length; ++p) {                 int key = (a[p] & mask) >> rshift;                 ++cntarray[key];             }           (int = 1; < cntarray.length; ++i)                         cntarray[i] += cntarray[i-1];               (int p = a.length-1; p >= 0; --p) {                 int key = (a[p] & mask) >> rshift;                 --cntarray[key];                 b[cntarray[key]] = a[p];             }               int[] temp = b; b = a; = temp;         }           if (a == b_orig)             system.arraycopy(a, 0, b, 0, a.length);     } } 

this downloaded wikipedia.

i feel algorithm work value of bits parameter divide 32 perfectly. thus, bits should 2 or 4 , not 10. please let me know if right.

short answer: no

long answer:

the probable line of confusion is:

for (int mask = ~(-1 << bits); mask != 0; mask <<= bits, rshift += bits) { 

mask <<= bits shifts bits of mask left bits, padding right zeros. if bits doesn't divide 32, full 32 bits won't utilised. while bits should divide 32, choosing value doesn't not break code.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -