Garmin
3.5 of 5 233 reviews
www.garmin.com Olathe, KS 5000+ Employees

Garmin Avionics Software Engineer Interview Question

I interviewed in Olathe, KS and was asked:
""Technical challenge" - with two anxious interviewers staring at you across a table provide code / pseudo code of how to reverse a linked list in five minutes or less with them showing visible frustration if you weren't ready for this. No other questions about C or C++, just do you remember data structures class from 20 years ago which you haven't had reason to use since."
Add Tags [?]
Answer Flag Question

Part of a Avionics Software Engineer Interview Review - one of 143 Garmin Interview Reviews

Answers & Comments

0
of 0
votes
Study up on data structures!
- Interview Candidate on Oct 11, 2012 Flag Response
0
of 0
votes
If I had to respond instantaneously, I'd probably have just said something about iterating over the list, pushing the elements onto a stack, then popping them off the stack and building a new list. Any recursive solution to this problem would probably be equivalent to this one unless it did something really weird (the call stack would implicitly be used as the stack that I used explicitly here).

However, you could also do this in constant space by just reversing the links themselves.
- guy on Dec 19, 2012 Flag Response
0
of 0
votes
A typical function without additional memory allocation would be:
// Let Arg represent the struct type of node of linked list
Arg *reverse(Arg *list){

  Arg *new_list = NULL;
  while (list) {

    Arg* next = list->next;
    list->next = new_list;
    new_list = list;
    list = next;
  }
  return new_list;
  }
- Shishir on Feb 13, 2013 Flag Response

To comment on this question, Sign In with Facebook or Sign Up


Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at Garmin interview questions and advice. All interview reviews posted anonymously by Garmin employees and interview candidates.