Search Algorithms Jennifer Mosher Math 382 Explicitly Stored - - PowerPoint PPT Presentation

search algorithms
SMART_READER_LITE
LIVE PREVIEW

Search Algorithms Jennifer Mosher Math 382 Explicitly Stored - - PowerPoint PPT Presentation

Search Algorithms Jennifer Mosher Math 382 Explicitly Stored Databases Bank account information Electronic documents Personnel data Manufacturing databases Financial databases An example: Quickbooks. Linear vs


slide-1
SLIDE 1

Search Algorithms

Jennifer Mosher Math 382

slide-2
SLIDE 2

Explicitly Stored Databases

  • Bank account information
  • Electronic documents
  • Personnel data
  • Manufacturing databases
  • Financial databases
  • An example: Quickbooks.
slide-3
SLIDE 3

Linear vs Binary Search

  • Linear Search
  • Goes through an

average of half of the array before it finds match.

  • Less Efficient
  • Two Situations
  • Binary Search
  • Goes through, at

most, half of the array before it finds match.

  • More Efficient
  • Array must be
  • rdered
  • Three Situations
slide-4
SLIDE 4

The Algorithms

  • {1, 2, 3, 4, 5}
  • Key = 3
  • Key is compared to

1, 2, 3…

  • Finds a match.
  • Returns index, in

this case 2.

  • {1, 2, 3, 4 ,5}
  • Key = 3
  • Key is compared to

middle element 3.

  • Key matches.
  • Returns index, again

2.

slide-5
SLIDE 5
  • {1, 2, 3, 4, 5}
  • Key = 7
  • Key is compared to

1, 2, 3, 4, 5.

  • The search does not

find a match.

  • Returns -1.
  • The search is

finished.

  • {1, 2, 3 , 4, 5}
  • Key = 7
  • Key is compared to

middle element, 3.

  • Doesn’t match.
  • 7 > 3
  • Searches second half
  • f array.
  • Key compared to 4

and 5.

  • No match, returns
  • (insertion point + 1) =
  • (5 + 1) = -6
slide-6
SLIDE 6

Binary Search Tree

  • Binary Search Tree uses nodes
  • Four Situations
slide-7
SLIDE 7

Virtual Search Spaces, Heuristics and Metaheuristics

  • Used to solve discrete optimization

problems

  • Approximate
  • Good solutions in short amount of time
  • Usually not optimal solution
slide-8
SLIDE 8

The Tabu Search

  • Created by Fred Glover, 1986
  • Metaheuristic
  • Tabu lists

– Short term memory of search – Tabus

  • Disallows moves that would undo prior moves
  • Sometimes too powerful

– Aspiration Criteria

slide-9
SLIDE 9

Termination of Tabu Search

  • Most popular ways:

– After a fixed number of iterations – After some number of iterations without improvement in the objective function value – When an object reaches a pre-specified threshold value

slide-10
SLIDE 10

Simulated Annealing

  • “Annealing”:

– Process of heating and then cooling something repeatedly for softening and making material less brittle.

  • Traveling Salesman Problem
  • Tricks:

– Allows Bad Trades – Lowering the temperature

  • Used for solving Sudoku
slide-11
SLIDE 11

Constraint Propagation

  • Constraint Satisfaction Problems (CSP)
  • Infers that certain values cannot be part of

certain variable domains because they violate some constraint.

  • An Example:

– Constraint: y - 2x, 1 < x < 2

– Conclusion: 2 < y < 4 – In other words, y cannot be less than or equal to 2, or greater than or equal to 4.

slide-12
SLIDE 12

Combinatorial Search

  • Used for CSP-like problems
  • Finds combinations of a discrete set of

items that satisfy certain constraints

  • Combinatorial Optimization:

– Finds a combination that maximizes or minimizes some parameter.

  • Drawback: solution time can grow

exponentially with the problem size.

slide-13
SLIDE 13

Quantum Computers

  • Today’s computers are limited to two

states: a 0 or a 1.

  • Quantum computer is not.

– 0, 1, or superposition of 0 and 1.

  • In other words the symbols are both 0

and 1 and all points in between at the same time.

slide-14
SLIDE 14

Grover’s Algorithm

  • Invented in 1996 by Lov Grover
  • Poses following problem:

– There is an unsorted database containing N items out of which just one item satisfies a given condition-- than item has to be retrieved. There does not exist any sorting on the database that would aid its selection.

  • Only other way is the Linear Search, which

would use O(N) steps.

  • Grover’s Algorithm would use O(Sqrt(N))
  • It is a quicker version of the linear search.
slide-15
SLIDE 15

The Importance of Search Algorithms

  • Integral part of new technology age of

the world.

  • Google.com, youTube, spell check,

searching for a song in iTunes, and more.