You can certainly ask "What did happen last night". However, the meaning changes to one of emphasis. The question asks not only what happened, but in contrast to some earlier discussion where something else was said not to have happened.
In the exasperated "Who does want to eat", it is the same situation: emphasis.
We also need the auxiliary, if the WH-word subject is paired with the verb "do":
- What {did you do | did you*} last night.
The * marked form sounds archaic. This construction probably occurs to avoid a perceived ambiguity: "what did you last night" sounds as if "did" is still auxiliary, and the verb is missing. "What did I what last night? What did I eat? What did I watch on TV? Oh, you're asking me what I did, in some outdated way of speaking; very funny!"
(Some uses of this word order in questions still occur in British English, I think, such as, "Have you the time?" "Had you enough to eat?" Children all over the English speaking world continue to pick up the syntax from nursery rhymes: "Baa baa black sheep, have you any wool?")
Note that since the "did" is required in "what did you do yesterday", it is possible to use it with or without emphasis:
- What { did* | did } you do yesterday? [Emphasis: I already know what you didn't do; please give me the contrasting information: what you did. No emphasis: inform me about your yesterday's activities.]
We can also put the emphasis almost anywhere in the above sentence: we can emphasize "did", "you", "do" or "yesterday", in order to make any of them the focus:
In our earlier sentences, we cannot use "did" without emphasis:
It is possible for another word to be emphasized simultaneously, in some very specific contextual situation where things are being contrasted in parallel pairs, or something of the sort:
- Okay so we established what didn't happen to Joe; so what did happen to Bob? [The focus is on Joe and Bob, and on what did happen to the former and didn't happen to the latter: two things in one sentence contrast pairwise with parallel things in the other.]
by which is legitmate phrase to use for expressing clarification, but, in your sentence, there should be no comma after it.
After collecting the candidates and prioritizing them using one of the above methods, the sorted candidates are stored as a list of line numbers by which the list give* a similar neighbourhood list as given by the r-tree (random tree) data structure.
That's long and hard to follow. I think it would be better to simply replace the by which with a full stop:
After collecting the candidates and prioritizing them using one of the above methods, the sorted candidates are stored as a list of line numbers. This list give* a neighborhood list similar to the one given by the r-tree structure.
One other suggestion: consider picking a different verb than give. I won't tell you which one (you're the domain expert), but you might try looking up synonyms for provide, construct, or return.
*denotes a verb that might be conjugated wrong.
Best Answer
To formalize what StoneyB said, computerized grammar checkers are only meant as guides because they don't know context, they only know rules. You really need a human editor or a place like this to figure out if you are writing / speaking something correctly.
In this case, your sentence is perfectly legit. What you are doing is asking a rhetorical question, because you, the author, are not expecting an answer to your question. Instead you are using your question to make a point.
Actually, they just added a canonical post about this very subject!