15.04.2018 Views

programming-for-dummies

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

422<br />

Adversarial Search<br />

The simplest way to speed up any search algorithm is to sort the data<br />

be<strong>for</strong>ehand. After a list has been sorted, the computer can use various techniques,<br />

such as block jumping or Fibonacci searching, to speed up the<br />

search.<br />

If data isn’t sorted, it may be possible to use an index. An index works most<br />

effectively when it organizes part of the stored data, such as indexing the<br />

last names of a customer list that contains names, addresses, and phone<br />

numbers. Although indexes can speed up searching, their need <strong>for</strong> constant<br />

updating makes adding and deleting data slower.<br />

Rather than search through stored data, strategy games, such as chess, must<br />

search through continuously changing data based on the position of the<br />

game pieces. To search through this ever-changing data, strategy games<br />

must rely on techniques to quickly eliminate bad moves so the computer<br />

can spend its time focusing only on evaluating the best moves.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!