0
$\begingroup$

The definition on Google says 'serving or intended to pre-empt or forestall something, especially to prevent attack by disabling the enemy.' So, how does this relate to an algorithm, especially the Nearest Neighbour Algorithm?

$\endgroup$
  • 2
    $\begingroup$ Your definition found on google is not one directly related to algorithms or computer science. That definition can be used in a context where e.g. one country attacks another so that is not attacked itself by that country. A computer science definition could be in the context of preemptive scheduling where it means that a process running on the CPU is interrupted to give another process CPU time without that process its consent and without guarantee to ever be given back the CPU. I'm not sure where it comes into play when considering k-NN. Where did you read it? $\endgroup$ – Auberon Aug 13 at 13:36
1
$\begingroup$

An arbitrary algorithm can't be preemptive or non-preemptive. Preemption is a mode of multitasking, used by an operating system to control user processes. From the Preemption Wiki page:

In computing, preemption is the act of temporarily interrupting a task being carried out by a computer system, without requiring its cooperation, and with the intention of resuming the task at a later time.

The opposite of Preemption is Cooperative Multitasking.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.