Bloomberg LP Interview Question for Financial Software Developers






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

If you apply dfs on graph if you visited a veter 'v' which is alreday visited already...there is a cycle

- Anonymous October 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

If undirected graph then apply DFS and if directed then BFS for same

- Aditya October 24, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Why BFS in directed graph and DFS in undirected? I simply do not get the reason

- dimitris March 05, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

bfs and dfs will only work on binary tress but the question is for graph so we have to use linked list and the hare and tortoise rule creating two pointers one moves to one node at a time and the other moves two nodes at a time whenever both point o same node there is a loop.

- deric January 16, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Yes..it was na undirected graph and I applied DFS...had to write code for it too

- Anonymous October 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Use a linked list for the graph. Check for the next value for each node of the list. if it points to existing value, then there is a loop.
Or, do hare and tortoise rule:
use two pointers, one moves one node at a time,
other moves two nodes at a time, if they happen to show the same value, and next pointer, then there is a cycle..

Source: hxxp://en.wikipedia.org/wiki/Cycle_detection#Time-space_tradeoffs

- Sriram October 27, 2010 | Flag Reply


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