talktomenow
BAN USER- 0of 2 votes
AnswersWhich is faster?
- talktomenow in India
while(1) {}
or
while(2) {}
I said both have same speed as the expression inside while should finally evaluate to true or false. in this case both evaluates to true and there are no extra instructions inside the while so both have same speed of execution. Interviewer said while (1) is faster than while (2).
I do not agree . do you ?
By the way interviewer was a senior manager (i,e. does not code on day-to-day basis)| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer - 0of 0 votes
Answersgiven a binary tree, assign a new next pointer to each node, such that next pointer points to any node which is right side of the node(ie it may point to its sibling right node , or a left node of next subtree).
if no node on right or if the node itself if right most, the next points to null6
/ \
7-------->2
/ \ / \
- talktomenow in United States1 - ->5-->4 ->13
| Report Duplicate | Flag | PURGE
Akamai Software Engineer / Developer Algorithm - 6of 8 votes
AnswersGiven a NxN matrix which contains all distinct 1 to n^2 numbers, write code to print sequence of increasing adjacent sequential numbers.
- talktomenow in United States
ex:
1 5 9
2 3 8
4 6 7
should print
6 7 8 9| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Algorithm
- 3 Answers Algorithms in interviews
Interviewers ask many algorithms questions in big MNCs. Do you think that these questions are good questions to ask in interviews ? Is it a good assumption that If a person who answers these questions will do the job? and does job involves inventing new alogorthms everyday
- talktomenow July 22, 2014
? I dont know why these types of questions are asked in interviews. If a person does not know about some algorthim, say Kadane's algorithm, then does interviewer expects canidates to invent it during interview. ? are not these algorithms were invented by many years of research? I am not able to understand the logic behind asking these types of question.| Flag | PURGE
I updated the question guys. its the adjacent sequential numbers like 6 7 8 but not 1 2 4
- talktomenow July 14, 2014
I have attempted a possible solution, but may still needs to be refined/corrected
- talktomenow July 14, 2014