Thus, the kth step of the iteration is roughly
LDS(k)(var, discrepancies):
if discrepancies > k
return
if var >= nvars
(a total assignment--do whatever)
...
return
Assign the value h suggested by the heuristic to var
LDS(k)(var + 1, discrepancies)
For each other value c that var can take on
Assign c to var
LDS(k)(var + 1, discrepancies + 1)
Need more information? Here are two papers by Will Harvey on LDS. The first is an IJCAI article about LDS with Matt Ginsberg. The second is Will's Ph.D. Dissertation.