Slide phân tích và thiết kế giải thuật chap6 backtracking algorithms

43 7 0
Slide phân tích và thiết kế giải thuật chap6 backtracking algorithms

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

j ) are constant cu u du o ng th an Given these data, the statement setqueen is refined as: x[i]:=j; a[j]:=false; b[i+j]:=false;c[i-j]:=false; The statement removequeen is refined as: a[j] = true; b[i+j] = true ; c[i-j] := true The condition safe is represented as: a[j] ∧ b[i+j] ∧ c[i-j] 18 CuuDuongThanCong.com https://fb.com/tailieudientucntt u=x+y 16 c om y ng an co th ng du o cu u x -7 CuuDuongThanCong.com -3 v=x-y https://fb.com/tailieudientucntt 19 cu u du o an co ng c om begin x[i]:=j; a[j]:=false; b[i+j]:=false; c[i-j]:=false; if i

Ngày đăng: 06/12/2021, 14:34

Mục lục

    The Knight’s Tour Problem

    The general pattern of backtracking algorithm

    The eight queens problem

    Rule of chess: A queen can attacks all other queens in either the same column, row or diagonal on the board

    Extension: Finding all solutions

    In the extended algorithm, to simplify the stopping condition of the selection process, the repeat statement is replaced by a

    Complexity of backtracking algorithm

    Exhaustive search: Modified DFS to generate all the simple paths

    An instance of TSP

    Exhaustive search to find all simple paths

Tài liệu cùng người dùng

Tài liệu liên quan