eXBii

Go Back eXBii > Technology> Technical Help & Tutorials > C/C++ programs :: Please contribute

Reply
 
Thread Tools Search this Thread
  #81  
Old 7th February 2005
mithunfan mithunfan is offline
misthinker
 
Join Date: 10th October 2004
Posts: 5,065
Rep Power: 26 Points: 3172
mithunfan is hunted by the papparazimithunfan is hunted by the papparazimithunfan is hunted by the papparazimithunfan is hunted by the papparazimithunfan is hunted by the papparazimithunfan is hunted by the papparazi
Quote:
Originally Posted by iwannabeac
http://gcc.gnu.org/

also, last i checked, google was up and running.
______________________________
replied

Reply With Quote
  #82  
Old 7th February 2005
sravu's Avatar
sravu sravu is offline
 
Join Date: 4th January 2005
Posts: 628
Rep Power: 21 Points: 579
sravu has many secret admirerssravu has many secret admirers
______________________________
------ Sravu

Reply With Quote
  #83  
Old 8th February 2005
gopipunjabi's Avatar
gopipunjabi gopipunjabi is offline
 
Join Date: 14th November 2004
Posts: 73
Rep Power: 21 Points: 71
gopipunjabi is beginning to get noticed

Reply With Quote
  #84  
Old 8th February 2005
ajrulez ajrulez is offline
Visit my website
 
Join Date: 10th October 2004
Location: Chicago, IL
Posts: 316
Rep Power: 21 Points: 64
ajrulez is beginning to get noticed
Send a message via AIM to ajrulez Send a message via MSN to ajrulez Send a message via Yahoo to ajrulez
UL: 1.48 gb DL: 2.09 gb Ratio: 0.71
Quote:
Originally Posted by pxs007
Easiest one I can think of : a simple hash. I will assume there are no duplicates in the number list (even if there was it would just mean a rehash ).

This is a problem posed in lotsa interviews. Anyone going to one should know this. Good one AJ.
Yes....thats an efficient solution Probably the most efficient one. They were looking for logic here rather than programing techniques...I mean I'm sure this answer wouldn't have ticked em off

Reply With Quote
  #85  
Old 8th February 2005
ajrulez ajrulez is offline
Visit my website
 
Join Date: 10th October 2004
Location: Chicago, IL
Posts: 316
Rep Power: 21 Points: 64
ajrulez is beginning to get noticed
Send a message via AIM to ajrulez Send a message via MSN to ajrulez Send a message via Yahoo to ajrulez
UL: 1.48 gb DL: 2.09 gb Ratio: 0.71
Quote:
Originally Posted by iwannabeac
umm ... assuming no dupes,

1. sum of all
2. find out how much is the difference of the sum from SUM(1...100).

shd give the missing.

OK?
That is exactly what they wanted to see actually They wanted entry level guys to think in this manner:

Sum of 1 to n = n (n+1) / 2
and then subtract...just what u said....bulls eye!

Last edited by ajrulez : 8th February 2005 at 09:09 AM.

Reply With Quote
  #86  
Old 8th February 2005
ajrulez ajrulez is offline
Visit my website
 
Join Date: 10th October 2004
Location: Chicago, IL
Posts: 316
Rep Power: 21 Points: 64
ajrulez is beginning to get noticed
Send a message via AIM to ajrulez Send a message via MSN to ajrulez Send a message via Yahoo to ajrulez
UL: 1.48 gb DL: 2.09 gb Ratio: 0.71
Duplicate...sorry

Last edited by ajrulez : 8th February 2005 at 09:13 AM.

Reply With Quote
  #87  
Old 8th February 2005
ajrulez ajrulez is offline
Visit my website
 
Join Date: 10th October 2004
Location: Chicago, IL
Posts: 316
Rep Power: 21 Points: 64
ajrulez is beginning to get noticed
Send a message via AIM to ajrulez Send a message via MSN to ajrulez Send a message via Yahoo to ajrulez
UL: 1.48 gb DL: 2.09 gb Ratio: 0.71
Another solution to the problem...not so efficient but one of the guys answered it this way:

Just deal with the list that is missing a number, sort it, and go thru the list subtracting every index [i] from index [i+1]..so when [i+1] - i > 1, u get the missing number

Reply With Quote
  #88  
Old 8th February 2005
loveguy loveguy is offline
 
Join Date: 12th January 2005
Posts: 13
Rep Power: 0 Points: 6
loveguy is an unknown quantity at this point
Here is the code for checking whether a no. is prime or not

let n be the no.


int flag=0;
for ( i=2;i<=n/2;i++)
{
if ( n % i==0)
{
flag=1;
}
}
if (flag!=1)
cout<<"The no. is prime";
else
cout<<"The no. is not prime";

Reply With Quote
  #89  
Old 9th February 2005
iwannabeac's Avatar
iwannabeac iwannabeac is offline
Custom title
  Election: NHB Elections (Contest)    Silver Coins: Contributed $25-$100 for XB server fund      
Join Date: 12th October 2004
Posts: 10,010
iwannabeac has disabled reputations
Send a message via MSN to iwannabeac Send a message via Yahoo to iwannabeac
UL: 6.10 gb DL: 2.78 gb Ratio: 2.20
Quote:
Originally Posted by ajrulez
Another solution to the problem...not so efficient but one of the guys answered it this way:

Just deal with the list that is missing a number, sort it, and go thru the list subtracting every index [i] from index [i+1]..so when [i+1] - i > 1, u get the missing number
hmm ... interesting.

I like the hash solution best, btw

Reply With Quote
  #90  
Old 9th February 2005
shrek12345 shrek12345 is offline
Banned
 
Join Date: 15th December 2004
Posts: 3,599
Rep Power: 0 Points: 746
shrek12345 has received several accoladesshrek12345 has received several accoladesshrek12345 has received several accolades
Send a message via Yahoo to shrek12345
Wow..awesome Guys..nice to see that u kept the thread alive ...I too will keep on contributing ...but let me see what are u discussing.....................

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


One of the largest message boards on the web ! All times are GMT +5.5. The time now is 03:31 AM.
Page generated in 0.02296 seconds