Good evening I was wondering if someone could please provide me with a simple pseudocode example of a deterministic algorithm... I will greatly appreciate it and surely give you points!!. thanks
To me, "deterministic" could mean many things:
P
that can be solved in polynomial time by a deterministic computer, as opposed to problems of complexity class NP
which can be only solved in polynomial time using a non-deterministic computer.Which of these do you mean?
The most simple deterministic algorithm is this random number generator.
def random():
return 4 #chosen by fair dice roll, guaranteed to be random
It gives the same output every time, exhibits known O(1)
time and resource usage, and executes in PTIME
on any computer.