Im trying to trace this code but get stuck at C ai What doe
I\'m trying to trace this code but get stuck at C[ a[i] ]++. What does C[a[i]]++ mean?
n= A. length lu r C.length = C.length c for 1 = 0 to r-1 . for i = 0 to n-1 ! or 1 forj-1 to Cti]Solution
The statement a++ means that the value of \'a\' gets returned after that the value of \'a\' is incremented by 1. C[A[i]]++ means that the value of C[A[i]] gets incremented by 1. That is equivalent to writing C[A[i]] = C[A[i]]+1, So first we resolve the value of A[i], the (i+1)th value in A let it be k, now we get the value of C[k] and add 1 to it and the assign this value to C[k].
![I\'m trying to trace this code but get stuck at C[ a[i] ]++. What does C[a[i]]++ mean? n= A. length lu r C.length = C.length c for 1 = 0 to r-1 . for i = 0 to n I\'m trying to trace this code but get stuck at C[ a[i] ]++. What does C[a[i]]++ mean? n= A. length lu r C.length = C.length c for 1 = 0 to r-1 . for i = 0 to n](/WebImages/9/im-trying-to-trace-this-code-but-get-stuck-at-c-ai-what-doe-999834-1761514919-0.webp)