Interview Question for Software Engineer / Developers


Country: India




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

Seems an irrelevant question...

- Messiah December 19, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

| | | | | 1 | | | | |
| | | | 2 | |3 | | | |
| | | 4| | 5| | | | |
| | | | | 6| | 7| | |
| | 8| | 9| | | | | |
| | | | 10| | 11| | | |
| | | | 12| | 13| | | |
| | | | | | 14| |15| |

- Anonymous December 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

- Anonymous December 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

d      k

- Anonymous December 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

|   |   |   |   | 1 |   |   |   |   |

|   |   |   | 2|    |3 |   |   |   |

|   |   | 4|   | 5 |   |   |   |   |

|   |   |   |   | 6 |   | 7|   |   |

|   |8 |   |9 |    |   |   |   |   |

|   |   |   |10|  |11|   |   |   |

|   |   |   |12|  |13|   |    |   |

|   |   |   |    |  |14|  |15|  |

- Anonymous December 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

In the above diagram, 1,5,6 comes in a single line and all the linked list(2->9->10->12 and
3->11->13->14) mentioned above comes in a single line. Imagining this tree, we have to devise to code put all the nodes that comes in a single line in a linked list.

- Anonymous December 19, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

if what you say is what it is required then below is what i'll do:
1. Assign coordinate (0,0) to the root node.
2. If the coordinate of a node is (x,y) then its left child should have a coordinate (x-1,y+1) and right child should have (x+1,y+1)
3. Recurse through the tree assigning coordinate to each node and also maintaining a hash table with x values as key and a linked list of nodes with that values of x as value. When you reach the leaf node the hash table values are the required link list. Instead of hash tabke an array of linked list can be used where array index will define the value of x.

- The Artist December 21, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yep thats right..But only x is enough. And also hash table is not required, we can add it directly to the corresponding linked list.

- Anonymous December 21, 2012 | Flag


Add a Comment
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.

Learn More

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.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More