Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
~823 People Reached
Favorite Tags
Member Avatar for want_to_code

[B]Given an array of elements. An element is called as a leader if it is greater than all the elements to the right of it. Print all the leaders in O(n)?[/B] The following is my approach.Can anyone tell me how to improve the code and also the current time complexity? …

Member Avatar for thines01
0
120
Member Avatar for want_to_code

the header file: [code] #include<stdio.h> struct IntArray { int schedule[30000]; int nSize; }; struct IntArray getSchedule(int browsingTime[], int noOfPersons, int timeSlot); [/code] the implementation file: [code] #include"leastremainingtime.h" void sort(int *a,int n) { int i=0,j=0,temp=0; for(i=0; i<n;i++) { for(j=0;j<n-1;j++) { if(a[j] > a[j+1]) { temp=a[j]; a[j]=a[j+1]; a[j+1]=temp; } } } } …

Member Avatar for want_to_code
0
110
Member Avatar for want_to_code
Member Avatar for 50701735
0
45
Member Avatar for want_to_code

[code] #include<stdio.h> #include<stdlib.h> #include<conio.h> struct node { int info; struct node* llink; struct node* rlink; }; typedef struct node* NODE; NODE insert(NODE root,int data) { NODE temp,cur,prev; temp=(NODE)malloc(sizeof(struct node)); if(temp==NULL) printf("\nOut of memory"); temp->info=data; temp->rlink=temp->llink=NULL; if(root == NULL) { printf("\n1st time\n"); root=temp; return root; } prev=NULL; cur=root; while(cur != NULL) …

Member Avatar for want_to_code
0
100
Member Avatar for want_to_code

[code=c] // a code which prints "hello world" #include<stdio.h> int main() { (&printf)("hello world"); return 0; } why does the above code work? #include<stdio.h> int main() { char str1[]="hello"; int j=762; char str2[]="hello"; if(str1==str2) printf("true %d\n",--j); else printf("\nfalse %d\n",j--); return 0; } [/code] //the above code prints "false 762", why? …

Member Avatar for Nick Evan
0
286
Member Avatar for want_to_code

1. [code] #include<stdio.h> int main() { int function(int); int t=function(1); printf("\tt=%d",t); t=function(2); printf("\tt=%d",t); t=function(3); printf("\tt=%d",t); return 0; } int function (int a) { int t; t = a<<2 + a; return t; } [/code] the output is t=8 t=32 t=96 i am not able to figure out why this is …

Member Avatar for Aia
0
161