Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 286 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
286
Dung lượng
1,4 MB
Nội dung
Series Editors Ǥ Editorial Board ǤǤ
Ǥ ABC Alexander Shen Laboratoire d’Informatique Fondamentale de Marseille (LIF) CNRS, Universit´e de la M´editerran´ee, Universit´e de Provence CMI 39 Rue Joliot-Curie 13453 Marseille Cedex 13 France alexander.shen@lif.univ-mrs.fr and Russian Academy of Sciences Institute for Information Transmission Problems Bolshoy Karetny per 19 Moscow, GSP-4, 127994 Russia Series Editors Jonathan M Borwein, FRSC Professor Laureate Director Centre for Computer Assisted Research Mathematics and its Applications, CARMA School of Mathematical & Physical Sciences University of Newcastle Callaghan NSW 2308 Australia Jonathan.Borwein@newcastle.edu.au Helge Holden Department of Mathematical Sciences Norwegian University of Science and Technology Alfred Getz vei NO-7491 Trondheim Norway holden@math.ntnu.no ISSN 1867-5506 e-ISSN 1867-5514 ISBN 978-1-4419-1747-8 e-ISBN 978-1-4419-1748-5 DOI 10.1007/978-1-4419-1748-5 Springer New York Dordrecht Heidelberg London Library of Congress Control Number: 2009942420 Mathematics Subject Classification (2000): 65K05, 65Yxx, 90Cxx, 68-01, 68W40 c Birkhăauser 1997 1st edition: c Birkhăauser 2008 Reprint of 1st edition in series: Modern Birkhăauser Classics c Springer Science+Business Media, LLC 2010 2nd edition: All rights reserved This work may not be translated or copied in whole or in part without the written permission of the publisher (Springer Science+Business Media, LLC, 233 Spring Street, New York, NY 10013, USA), except for brief excerpts in connection with reviews or scholarly analysis Use in connection with any form of information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed is forbidden The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights Printed on acid-free paper Springer is part of Springer Science+Business Media (www.springer.com) To the memory of Anna Pogossiants Contents Preface to the second edition xi Variables, expressions, assignments 1.1 Problems without arrays 1.2 Arrays 15 1.3 Inductive functions 28 Generation of combinatorial objects 2.1 Sequences 2.2 Permutations 2.3 Subsets 2.4 Partitions 2.5 Gray codes and similar problems 2.6 Some remarks 2.7 Counting 33 33 34 35 37 39 44 46 Tree traversal (backtracking) 3.1 Queens not attacking each other: position tree 3.2 Tree traversal 3.3 Queens: position tree implementation 3.4 Backtracking in other problems 49 49 50 56 59 Sorting 4.1 Quadratic algorithms 4.2 Sorting in n log n operations 4.3 Applications of sorting 4.4 Lower bound for the number of comparisons 4.5 Problems related to sorting 61 61 62 69 70 72 vii viii Contents Finite-state algorithms in text processing 77 5.1 Compound symbols, comments, etc 77 5.2 Numbers input 79 Data types 6.1 Stacks 6.2 Queues 6.3 Sets 6.4 Priority queues 83 83 89 97 100 Recursion 7.1 Examples 7.2 Trees: recursive processing 7.3 The generation of combinatorial objects; search 7.4 Other applications of recursion 103 103 106 109 113 Recursive and non-recursive programs 8.1 Table of values (dynamic programming) 8.2 Stack of postponed tasks 8.3 Difficult cases 119 119 123 126 Graph algorithms 129 9.1 Shortest paths 129 9.2 Connected components, breadth- and depth-first search 133 10 Pattern matching 10.1 Simple example 10.2 Repetitions in the pattern 10.3 Auxiliary lemmas 10.4 Knuth–Morris–Pratt algorithm 10.5 Boyer–Moore algorithm 10.6 Rabin–Karp algorithm 10.7 Automata and more complicated patterns 10.8 Suffix trees 139 139 142 143 144 146 148 149 156 11 Games analysis 11.1 Game examples 11.2 Game cost 11.3 Computing the game cost by backtracking 11.4 Alpha-beta pruning 11.5 A retrospective analysis 167 167 169 176 178 182 ... Science and Technology Alfred Getz vei NO-7491 Trondheim Norway holden@math.ntnu.no ISSN 186 7-5 506 e-ISSN 186 7-5 514 ISBN 97 8-1 -4 41 9-1 74 7-8 e-ISBN 97 8-1 -4 41 9-1 74 8-5 DOI 10.1007/97 8-1 -4 41 9-1 74 8-5 Springer... source and camera-ready copy; please look at ftp://ftp.mccme.ru/users /shen/ progbook and/ or contact the author (e-mail addresses: shen@ landau.ac.ru, shen@ mccme.ru, sasha .shen@ gmail.com, alexander. shen@ lif.univ-mrs.fr)... b := a - b; {a = a0 + b0, b = a0} a := a - b; {a = b0, b = a0} A Shen, Algorithms and Programming, Springer Undergraduate Texts in Mathematics and Technology, DOI 10.1007/97 8-1 -4 41 9-1 74 8-5 1,