189 Discussion / Question Topics

Remove Filter
Member Avatar for nitin1

You have 9 horses and you have to select fastest 3. You can make a race of 3 horses in one time. So how many time you have to make a race? thanks :-)

Member Avatar for chris.stout
0
283
Member Avatar for nitin1

Can any one please help me to optimize the sieve to find the primes upto 10^8 ? I want very efficient algorithm to find all primes till 10^8 for cryptsystem. i have implemented the naive sieve which is taking too much time. please sgare some classic approach with me. i …

Member Avatar for Adak
0
80
Member Avatar for nitin1

i have to do division without divison/multiplication/mod operator. how can i ? int divide(int dividend, int divisor) { int p=1; if(dividend<0) { p*=-1; dividend*=-1; } if(divisor<0) {p*=-1; divisor*=-1; } while(dividend>=divisor) { dividend-=divisor; } return dividend*p; } i have done this, but this giving time limit exceeded when input is 1234567890,1. …

Member Avatar for somjit{}
0
224
Member Avatar for nitin1

#include<stdio.h> #include<limits.h> #define num 86090000 int a[5000000]={0}; short int s[99999999]; void sieve() { int i,j,p=sqrt(num); int k=0; a[k++]=2; for(i=3;i<=num;i=i*i) { s[i]=1; } s[3]=0; for(i=5;i<=num;i=i*i) { s[i]=1; } s[5]=0; for(i=7;i<=num;i=i*i) { s[i]=1; } s[7]=0; for(i=11;i<=num;i=i*i) { s[i]=1; } s[11]=0; for(i=13;i<=num;i=i*i) { s[i]=1; } s[13]=0; for(i=17;i<=num;i=i*i) { s[i]=1; } s[17]=0; for(i=19;i<=p;i+=2) { …

Member Avatar for Tumlee
0
94
Member Avatar for nitin1

int main() { int i=5; printf("%u",&i); return 0; } will the address which it will print is physical address of that variable or logical address ? I may not be clear in the defination of physical and logical address. thanks if you can help me ;)

Member Avatar for deceptikon
0
104
Member Avatar for nitin1

Can anyone exactly tell that how do we decide the complexity in this case. like nlogn +n , then the overall complexity is ? like, if O(f(n)+g(n)) can be equal to max(f(n),g(n)) ? Can we say this ? thanks

Member Avatar for deceptikon
0
41
Member Avatar for nitin1

#include<stdio.h> int dp[20]; int lis(int a[],int n) { int i,j,sum=0; dp[0]=1; for(i=0;i<6;i++) { for(j=i+1;j<n;j++) { if(a[j]>=a[i]) { dp[j]=dp[j-1]+1; } else dp[j]=dp[j-1]; } } } int main() { int a[]={ 5, 3, 4, 8, 6, 7}; int i=0; lis(a,6); for(i=0;i<6;i++) printf("%d ",dp[i]); getch(); return 0; } hi , this is the …

Member Avatar for nitin1
0
282
Member Avatar for nitin1

x^2 + S(x)*x - n=0 where n can be till 10^8 interger . and s(x) is the sum of the digits of the x integer. we have to print the value of x for which this equation holds otherwise print -1. my answer is taking too much time with brute …

Member Avatar for Gonbe
0
127
Member Avatar for nitin1

#include<stdio.h> #define num 10000000 int a[10000009]={0}; void sieve() { int i,j; for(i=2;i<=3164;i++) //loop till sqrt of largest number 10^7 { if(a[i]==0) // all primes are marked 0 { for(j=i*i;j<=num;j+=i) { if(a[j]==0) a[j]=i; // if i is prime then all it's multiples pos have value of i } } } return; …

Member Avatar for TrustyTony
0
219
Member Avatar for nitin1

here is a DP problem which i am solving from 2 days now. and i am finding a damn difficult. can you please tell what is overlaaping subproblem and what is optimal substructure in this problem. then i will try it again. any help will be appreciated. thanks http://www.spoj.pl/problems/GNYR09F/ thanks

Member Avatar for Gonbe
0
176
Member Avatar for nitin1

actually, I want to improve my number theory concepts more and more as i need it in much extent. is there any good website or any book which can help me so as to make my needs? i am not weak or something like that in number theory, but still …

Member Avatar for np complete
0
126
Member Avatar for nitin1

#include <stdio.h> #include <math.h> int main(void) { int number; double result; printf ("\n Introduce an integer: "); scanf ("%i", &number); result= sqrt (number); if ((result * result)== number) printf ("\n The integer HAS a perfect square \n\n"); else printf ("\n The integer DOES NOT HAVE a perfect square \n\n"); } …

Member Avatar for somjit{}
0
174
Member Avatar for nitin1

actually , I am working on a project and i need to sort the co-ordinates in the increasing y value. input: 1 2 3 4 5 6 6 6 7 8 4 5 like this, and i need to sort them in the increasing y value. my approach: i think …

Member Avatar for nitin1
0
115
Member Avatar for nitin1

Can anyone give me hint how to develop the suffix array part ? i know the concept, LCP array design but i am not gettinng how to implement in C ? can anyone please help. I know the uses, algo of suffix array as i have read a lot on …

Member Avatar for mrnutty
0
161
Member Avatar for nitin1

hey, i want to do a question in which i am given n line segments and i want to find the number of intersection of them. Can anyone tell me the most efficient way i can do it ? I have got some links on google and also from books …

Member Avatar for rithish
0
95
Member Avatar for nitin1

i mean when our solved threads increases, then on what basis they are increased because more of the threads are not marked solved. thanks

Member Avatar for stultuske
0
132
Member Avatar for nitin1

http://www.spoj.pl/problems/FP/ here is the link. Can anyone please give me the hint only that how greedy approach is following in this question ? It's strange to see how greedy is there in this question. just the hint of this. no code, nothing! thanks.

Member Avatar for Adak
0
131
Member Avatar for nitin1

isn't there any way that you can know who is downvoting or upvoting your posts ? if yes, then how can i know that ? thanks ;) may be this feature can be added. ;)

Member Avatar for happygeek
0
534
Member Avatar for nitin1

#include<stdio.h> #define MOD 100000009 #define REP(i, n) for(i = 0; i < n; ++i) void mul(int a[2][2],int b[2][2]) { int i,j,k; int c[2][2]; for(i=0;i<2;i++) { for(j=0;j<2;j++) { c[i][j]=0; for(k=0;k<2;k++) { c[i][j]+=(a[i][k]*b[k][j]); } } } // matrix multiply i=0;j=0; REP(i,2) REP(j,2) b[i][j]=c[i][j]; // copying the value in back to b[][] return; …

Member Avatar for deceptikon
0
133
Member Avatar for nitin1

Can anyone tell me the good maths forums' names ? I have sometimes doubts in maths while doing coding or something like that. like daniweb is good for computers, Do anyone know about maths forums ? thanks.

Member Avatar for nitin1
0
203
Member Avatar for nitin1

#include<stdio.h> int main() { char a[60][60],b[60][60],i=0,n1,m1,n2,m2; int x,y; int j=0; char c; int p=-1,q=-1,f=-1,g=-1; scanf("%d%d",&n1,&m1); for(i=1;i<=n1;i++) scanf(" %s",a[i]); scanf("%d%d",&n2,&m2); for(i=1;i<=n2;i++) scanf(" %s",b[i]); for(i=1;i<=n1;i++) { for(j=1;j<=m1;j++) { if(a[i][j]=='1') { p=i; q=j; break; } } if(p>0 || q>0) break; } for(i=1;i<=n2;i++) { for(j=1;j<=m2;j++) { if(b[i][j]=='1') { f=i; g=j; break; } } if(g!=-1 …

Member Avatar for np complete
0
131
Member Avatar for nitin1

it's too late and i just switch on the PC just for daniweb ;) But what else can i do on daniweb when i don't have any doubt to ask ? :(

Member Avatar for kemcar
0
170
Member Avatar for nitin1

in my exam, there was a question: what is linux/command which can't be ignored in any way? write the command to kill a process having id 1234 ? my answer was : SIGKILL and for second part i have written a C code function kill(1234,SIGKILL). now my teacher is saying …

Member Avatar for nitin1
0
116
Member Avatar for nitin1

**Because it is a compile-time operator that, in order to calculate the size of an object, requires type information that is only available at compile-time. This doesn't hold for C++.** i have read this statement roght now when implementing one library function. why it doesn't hold for C++? secondly, i …

Member Avatar for myk45
0
269
Member Avatar for nitin1

actually, i have just started using Ubuntu these days(though i have knowledge of unix/linux from past 2-3 years but didnot worked practically) .Can you give me best links in your knowldge for commands related to networking? I have read from about 15 links from google.com. But still i want more …

Member Avatar for nitin1
0
141
Member Avatar for nitin1

hi, actually I am learning C from past 1 year now and have learnt alot in C. I have read many many books and have solved alot problems in C. now, i am thinking so as to do some kind of project in C/C++. can anyone suggest me some kind …

Member Avatar for Bob
0
172
Member Avatar for nitin1

char c[]= "JOJO1993"; char *p =c; printf( "%s", p+p[3] -p [1]) ; this is a code snippet. p is a pointer and when it is used as *(p+3) means 4th character. but my question how can a char pointer can be used as pointer to first byte of any object …

Member Avatar for nitin1
0
110
Member Avatar for nitin1

though, i am in red eye of all administartors , mod of daniweb team, but seriosuly i am getting too much help from daniweb. all mates asks me who tells me all the doubts?. ,My C concepts are improving day by day, all are astonished which book i am reading, …

Member Avatar for nitin1
3
212
Member Avatar for nitin1

let's now discuss the ways that can give you sweet sweet and sugar plum like infraction points ? ;) lol

Member Avatar for nitin1
-2
212
Member Avatar for nitin1

I am using Daniweb from around 2 years(although was not a good user from that time). But i never come to know how daiwb earns money ? Is daniweb just a forumn or is it a company ? people working on this forumn who are adminsitrators, moderators , team colleague …

Member Avatar for nitin1
0
245
Member Avatar for nitin1

it is request to whole daniweb that please give me infraction points as much as you can. if you all don't want me to live here, then give 6 more then i will be lost. just for a small 1 thing, 2 points. so keep giving me points dude! thanks …

Member Avatar for nitin1
-7
191
Member Avatar for nitin1

if there will be sifficient "yes", then i will give a song to everybody of me to listen ;) just wana know how good other countries people like my song. ;)

Member Avatar for deceptikon
0
160
Member Avatar for nitin1

I here by request daniweb that can't they have a sperate section for specially algorthims ? I have seen that many people post their algortihm problems in C, C++ (although they say it should be code in C or C++) But , if they want only algo of that question …

Member Avatar for nitin1
0
165
Member Avatar for nitin1

i Wana start a project on this topic. what is the scope of this topic as i want to do MS in future. Is there any coding related work in this ? I have just started this project 5 days before. thanks

Member Avatar for np complete
0
102
Member Avatar for nitin1

why daniweb.com don't give warning first before giving it ? it is very bad to see these points. there must be warning first. :'(

Member Avatar for nitin1
0
371
Member Avatar for nitin1

i Wana start a project on this topic. what is the scope of this topic as i want to do MS in future. Is there any coding related work in this ? I have just started this project 5 days before. thanks.

Member Avatar for np complete
0
202
Member Avatar for nitin1
Member Avatar for cereal
0
31
Member Avatar for nitin1

actually, I was thinking arbitrary that i should make my own sizeof function. till date, i have made many many my own C functions which are also defined in C libraries. but i got strucked in sizeof operator desiging. can anyone give me hint how to start with this ? …

Member Avatar for deceptikon
0
169
Member Avatar for nitin1

hello! I am new on daniweb.com. I am happy to join this. will post my any doubt here.

Member Avatar for nitin1
0
117

The End.