difficulty about decode problem!!!

H

hotjuly

hello everyone, first time here! problem coming soon...

int a[n]={...};
// a>= 0 && a<n && n<10
// a != a[j] && i != j

int b[n]={...};
// the value of b is the number of a[0] to a[i-1] < a
// so the b[0] must be 0

a[5]={0,1,2,3,4,} then b[5]={0,1,2,3,4,}
a[5]={1,4,2,0,3,} then b[5]={0,1,1,0,3,}
a[5]={4,3,2,1,0,} then b[5]={0,0,0,0,0,}

now we have known b[n],decode b[n] to a[n] ???

email: (e-mail address removed)
 
R

russell kym horsell

} hello everyone, first time here! problem coming soon...
} int a[n]={...};
} // a>= 0 && a<n && n<10
} // a != a[j] && i != j
} int b[n]={...};
} // the value of b is the number of a[0] to a[i-1] < a
} // so the b[0] must be 0
} a[5]={0,1,2,3,4,} then b[5]={0,1,2,3,4,}
} a[5]={1,4,2,0,3,} then b[5]={0,1,1,0,3,}
} a[5]={4,3,2,1,0,} then b[5]={0,0,0,0,0,}
} now we have known b[n],decode b[n] to a[n] ???

Sometimes you can solve a problem by reduction (sometimes called
recursion) -- solve a part and end with the same or similar problem,
but smaller.

In this case try to find a way to compute b[n]. Then you can
ignored a[n] and b[n] and you have the same decoding problem for n-1.
 
T

Thad Smith

hotjuly said:
hello everyone, first time here! problem coming soon...

int a[n]={...};
// a>= 0 && a<n && n<10
// a != a[j] && i != j

int b[n]={...};
// the value of b is the number of a[0] to a[i-1] < a
// so the b[0] must be 0

a[5]={0,1,2,3,4,} then b[5]={0,1,2,3,4,}
a[5]={1,4,2,0,3,} then b[5]={0,1,1,0,3,}
a[5]={4,3,2,1,0,} then b[5]={0,0,0,0,0,}

now we have known b[n],decode b[n] to a[n] ???


I don't see a C question (or any English question) here. I suggest
formulating a question, then asking in comp.programming, where it would
be more appropriate (followups set to comp.programming). Giving your
ideas first is a good way to solicit help.
email: (e-mail address removed)

Private tutors are usually expensive. Ask in the newsgroup, read
responses in the newsgroup.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top