nikkiani1991
BAN USER1. Assuming length of all the array is fixed and same i.e. length
2. Here a[k][i] means ith element of kth array among N arrays. Just didn't get in my mind how to represent kth array so used this notation.
3. Starts from the back of the array. Takes the last element of all of the array and insert the maximum in last position of given_array and again inserts less than max in last-1 position.
4. Again for second last element of all the arrays.
#define Total_length length*NoOfArrrays
int given_array[Total_length]
int p=Total_length
for(int i=lenth;i>0;i--){
for(int j=0;j<NoOfArrays;j++){
for(int k=j; k<NoOfArrays;k++) {
if( a[k][i] > a[j][i] )
swap(a[k][i] , a[j][i] );
}
given_array[length--]=a[j];
}
}
p.s. Improve if i am wrong !!!!
- nikkiani1991 November 11, 2012This may be another solution...I used 128 int array which is used to indicate the duplicity of characters......you can use of ur own choice to reduce wastage of memory usage
Nonetheless this is of O(1) space complexity and O(n) time complexity
void rem_dup(char* str){
int i[128],k=0;
for(int j=0;j<128;j++)
i[j]=0;
for(int p=0;str[p]!='\0';p++){
if(i[int(str[p])]==0) {
str[k]=str[p];
k++;
i[int(str[p])]=1;
}
}
str[k]='\0';
}
if max(xyz)-min(xyz) is not less than result what to do then ?
consider:
A1: 5 7 9 11 12 20
A2: 4 5 11 14 16 20
A3: 1 3 4 8 10 20
Obviously the format is CSV
The data is stored in flat file. The data in a particular columns is delimited by space or tab. The rows/records are separated by newline. Let say we have n columns in a record/row. To access the particular data(x,y) we can count x newline('\n') and y-1 spaces and read the data.
RepRutviOrtiz, Android Engineer at AMD
I am experienced in teaching other translators through one-on-one mentoring and professional development courses. I am passionate about Unbinding spell ...
@praveen Your code doesn't consider case in which one of the node is head and second is in left sub-tree and third is in right sub-tree.
- nikkiani1991 November 14, 2012