## abc Interview Question for Computer Scientists

- 0of 0 votes

Answersyou have a numbers between 1 to n. a set of number i.e. (4,5) means that person number 4 is connected to person number 5. find all the ways the a group of n pepole can be connected. i.e. for 0 and 1 there is the empty set, for 2 there is 2 ways, empty set and {1,2} only for 3 there are 4 ways: {}, {(1,2)} {(2,3)}, {(3,1)}

- Patrick November 28, 2014 in United States

for 4 there are 10 ways ({},{(1,2)}, {(1,2),(3,4)},.......

you can do it by factorial and cobination but there is another way that state that:

T(n)=T(n-1) + (n-1)*T(n-2)

(while T(n) is the function that computes the number of ways..

can someone explain why this equation is true?

Thanks...| Report Duplicate | Flag | PURGE

abc Computer Scientist Algorithm

Email me when people comment.

Email me when people comment.

Loading...

An error occurred in subscribing you.

**Country:**United States

**Interview Type:**Written Test

Email me when people comment.

Email me when people comment.

Loading...

An error occurred in subscribing you.

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window