## Interview Question

Country: United States

Comment hidden because of low score. Click to expand.
0
of 0 vote

Which company?

Comment hidden because of low score. Click to expand.
0
of 0 vote

It might not be possible for certain inputs. Consider, a graph like:

O----O----O

Comment hidden because of low score. Click to expand.
0
of 0 vote

I think this problem can be solved if we have a tree where no vertice has more than two edges, something like a link list perhaps. But a for a general tree it would depend on the kind of way the tree's edges and vertices are spread out. I can't be sure about it though. Please help if anyone ha a better answer

Comment hidden because of low score. Click to expand.
0
of 0 vote

1. every node should have at least one node associated with it.
2. say m = roof(n/2). max no of edges should be m+(m-1)+(m-2) .....1.
2. min can be n/2.
these are some observations of mine
seems to be necessary to make such combination but not sufficient.

Comment hidden because of low score. Click to expand.
0
of 0 vote

here is the solution... noob-g4ur4v.blogspot.in/2012/08/interviewstreet-even-tree.html

Comment hidden because of low score. Click to expand.
0

can u pls explain the algo a bit..??

Comment hidden because of low score. Click to expand.
0
of 0 vote

I solved this on interviewstreet.com using the following algo..
make a map of a node vs the no. of nodes connected to it..
iterate over the map
if for the ith node, the no. of nodes connected == even
-- then iterate over the nodes list connected to this node.
now for every connected jth node, again get the no. of nodes connected this jth node
if the no. of nodes connected to jth node == odd,
cut the edge ( increement the counter of cut edges )

Comment hidden because of low score. Click to expand.
0
of 0 vote

{{

}}

Comment hidden because of low score. Click to expand.
0
of 0 vote

{{
{}{}{}
}}

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.