By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,913 Members | 1,379 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,913 IT Pros & Developers. It's quick & easy.

pseudo code to c code

P: 1
LIS( int arr[], int n )
for (i = 0; i < n; i++ )
lis[i] = 1;
/* Compute optimized LIS values in bottom up
manner */
for (i = 1; i < n; i++ )
for (j = 0; j < i; j++ )
if ( arr[i] > arr[j] && lis[i] < lis[j]
+ 1)
lis[i] = lis[j] + 1;
/* Pick maximum of all LIS values */
for (i = 0; i < n; i++ )
if (max < lis[i])
max = lis[i];
return max;
1 Week Ago #1
Share this Question
Share on Google+
1 Reply


100+
P: 135
- Declare the variables and array that are being used.
- Add curly braces wherever required.
- Single line statement under a loop or if condition doesn't have to be enclosed in curly braces.
1 Week Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.