Click here to Skip to main content
15,898,222 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Records and Clusters Pin
Member 41945935-Nov-08 7:44
Member 41945935-Nov-08 7:44 
GeneralRe: Records and Clusters Pin
DQNOK6-Nov-08 4:54
professionalDQNOK6-Nov-08 4:54 
GeneralRe: Records and Clusters Pin
Member 41945936-Nov-08 7:57
Member 41945936-Nov-08 7:57 
GeneralRe: Records and Clusters Pin
Member 419459325-Apr-09 4:28
Member 419459325-Apr-09 4:28 
GeneralRe: Records and Clusters Pin
DQNOK27-Apr-09 3:13
professionalDQNOK27-Apr-09 3:13 
GeneralRe: Records and Clusters Pin
DQNOK27-Apr-09 5:57
professionalDQNOK27-Apr-09 5:57 
GeneralRe: Records and Clusters Pin
Member 419459327-Apr-09 11:22
Member 419459327-Apr-09 11:22 
QuestionRePosted from C# Forums: A Job Exam Question Pin
Bulky Fellow4-Nov-08 20:31
Bulky Fellow4-Nov-08 20:31 
My office is testing a bunch of folks who have applied for Java jobs. I don't know head and tails
of the language other than that its syntax is stolen from here and there (I'm still partyin' with
MFC/Win32, yay!). My buddy was the invigilator and got the questions' sheet. This was one of the
easiest assignments, and shockingly, only 3 out of the 14 people that attempted this problem finished
it correctly on time. Some took more than 45 minutes but got it right, and others didn't solve it at
all! I tried it for the hell of it beat the time by 29 minutes, finishing at 16 minutes (C/DevCPP),
which I guess is not bad. Post your times here, and see if you can bring it down below 16 minutes. Wink | ;)

Q7. (Note: You cannot answer Questions 8, 11 and 14 if you are answering this question.
Pick another 2 from the rest).
Write a command-line program as follows:

First the program will take as input a +ve integer from the user, let's call it
the TARGET.

It will then take in a set of +ve integers from the user, and here the user gets
to specify how many integers he/she wants to enter. Let's call this set the
RANGE.

Now the program should compute as follows:

- Find all combinations in the RANGE, the sum of which add up to the
  target. Print such combinations at the command prompt. In a combination,
  repeats are not allowed. i.e. (x + x + y) = TARGET is forbidden. Every element
  in the combination must be unique.

- In case a user enters a RANGE element greater than the target, it should be immediately
  discarded and the user must be prompted for the element again.
  
- Order shifted cases don't count. i.e. (x+y) and (y+x) being printed
  separately is unnecessary and MUST be avoided.
  
- In case no combinations exist, the program should report so.

- Add exception handling code where necessary.

Example Run:

Enter Target: 15
How many set elements?: 5
Enter Element1: 7
Enter Element2: 8
Enter Element3: 12
Enter Element4: 3
Enter Element5: 22
Sorry. That element is larger than your target. Try again.
Enter Element5: 4

Combinations are:
1] 7+8
2] 8+3+4
3] 12+3

Time: 45 mins.

(At the top of the source file, please comment in your ID details along with the reference
number at the back of the day-card you were provided by the examiner. Write your Full Name,
ID key, TDC number and most importantly the reference number. Good luck.)


ASP - AJAX is SEXY. PERIOD.

AnswerRe: RePosted from C# Forums: A Job Exam Question Pin
Arash Partow4-Nov-08 21:59
Arash Partow4-Nov-08 21:59 
AnswerRe: RePosted from C# Forums: A Job Exam Question Pin
Mark Churchill5-Nov-08 1:46
Mark Churchill5-Nov-08 1:46 
GeneralRe: RePosted from C# Forums: A Job Exam Question Pin
riced9-Nov-08 4:03
riced9-Nov-08 4:03 
GeneralRe: RePosted from C# Forums: A Job Exam Question Pin
Bulky Fellow9-Nov-08 7:45
Bulky Fellow9-Nov-08 7:45 
GeneralRe: RePosted from C# Forums: A Job Exam Question Pin
Mark Churchill9-Nov-08 11:33
Mark Churchill9-Nov-08 11:33 
QuestionTrammel method for constructing an ellipse Pin
hxhl9525-Oct-08 19:38
hxhl9525-Oct-08 19:38 
AnswerRe: Trammel method for constructing an ellipse Pin
73Zeppelin25-Oct-08 23:52
73Zeppelin25-Oct-08 23:52 
GeneralRe: Trammel method for constructing an ellipse [modified] Pin
Luc Pattyn26-Oct-08 9:02
sitebuilderLuc Pattyn26-Oct-08 9:02 
GeneralRe: Trammel method for constructing an ellipse Pin
hxhl9526-Oct-08 16:43
hxhl9526-Oct-08 16:43 
QuestionPRECISION and ACCURACY Pin
εїзεїзεїз22-Oct-08 1:27
εїзεїзεїз22-Oct-08 1:27 
JokeRe: PRECISION and ACCURACY Pin
CPallini22-Oct-08 2:21
mveCPallini22-Oct-08 2:21 
AnswerRe: PRECISION and ACCURACY Pin
73Zeppelin22-Oct-08 2:58
73Zeppelin22-Oct-08 2:58 
GeneralRe: PRECISION and ACCURACY Pin
εїзεїзεїз22-Oct-08 3:10
εїзεїзεїз22-Oct-08 3:10 
GeneralRe: PRECISION and ACCURACY Pin
Andrew Rissing22-Oct-08 6:53
Andrew Rissing22-Oct-08 6:53 
GeneralRe: PRECISION and ACCURACY Pin
73Zeppelin22-Oct-08 7:02
73Zeppelin22-Oct-08 7:02 
GeneralRe: PRECISION and ACCURACY Pin
Paul Conrad22-Oct-08 8:05
professionalPaul Conrad22-Oct-08 8:05 
GeneralRe: PRECISION and ACCURACY Pin
PIEBALDconsult13-Nov-08 16:14
mvePIEBALDconsult13-Nov-08 16:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.