The scenario is one that requires so many worst-case-scenario events to be happening simultaneously as to say the scenario is likely avoidable altogether in one of numerous ways. So yes, I'm calling your hypothetical scenario a little contrived.
To answer the hypothetical with the answer you're expecting; people have already made this choice in the past for disaster scenarios:
"Women and children first."
The algorithm would choose to hit the elderly person over the child in your scenario. The ethical choice becomes more complex if the pedestrians in question are both children or both women. I don't think humans have made an ethical decision on such a choice.
So yes, I'm calling your hypothetical scenario a little contrived.
Yes, that is the often the point of hypothetical scenarios.I was not expecting any particular answer, I simply find the problem interesting. It begs the question: Does this mean there is a line of code somewhere that ultimately has to make that decision?
Without the code a more simple scenario plays out. The car continues along its current trajectory and kills whichever pedestrian was in front of the vehicle, which could be both of them.
Women and children first is not a policy of who is most valuable. It is a policy of who is most vulnerable. In disasters it is presumed that the women and children cannot fend for themselves (and while there is a biological aspect to women being on average weaker than men the presumption of women and children first is still painfully sexist) and that the men coming up behind are more likely to survive than any alternative, where men go first and "the vulnerable" take up the rear.
Even besides that, how do you know if a child is more valuable than an elderly person?
Its not as simple a problem as yesteryears well intentioned sexism and ageism. But the real answer is much simpler:
The car would, in the situation where it could not avoid hitting a person, hit whomever it computes to be most likely to survive.
The choice of children vs elderly rarely comes down to value - but rather life. The elderly person has lived their life while the child, potentially, has many more years ahead of them. Humans don't tend to give a value to life other than life itself - and extending life or saving multiple lives over a single life tends to be the popular choice. It would be impossible to judge a persons' "value" or measure it without having information on them prior to the event.
See: The Trolley Problem
[0] http://healthland.time.com/2011/12/05/would-you-kill-one-per...