Frage im Vorstellungsgespräch bei Yahoo

Write code to reverse a linked list? ( do not use libraries like stack)

Antworten zu Vorstellungsgespräch

Anonym

4. Feb. 2021

In these sorts of interviews you really need to drill down and understand what the interviewer is looking for. A good way to simulate a real interview experience is to do a mock with one of the Yahoo QA Engineer experts on Prepfully, rated super strongly on TrustPilot... prepfully.com/practice-interviews

Anonym

9. Nov. 2010

Could someone please tell if this answer is a correct one. This is assuming that the linked list is a single linked list. Top is a pointer to the first element of the linked list prev_temp, Temp and next_temp are pointers which are used to actually reverse the linked list here is the algorithm /* Code starts from here */ prev_temp = NULL; temp = Top; while(temp != NULL) { next_temp = temp->next; temp->next = prev_temp; prev_temp = temp; temp = next_temp; } top = prev_temp;