1. Trang chủ
  2. » Tất cả

Algorithms and Programming 2nd Ed - Problems and Solutions - Alexander Shen (2010)

286 24 0

Đ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

Cấu trúc

  • Cover

  • Springer Undergraduate Texts in Mathematics and Technology

  • Algorithms and Programming: Problems and Solutions, Second Edition

  • ISBN 9781441917478

  • Contents

  • Preface to the second edition

  • 1 Variables, expressions, assignments

    • 1.1 Problems without arrays

    • 1.2 Arrays

    • 1.3 Inductive functions

  • 2 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

  • 3 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

  • 4 Sorting

    • 4.1 Quadratic algorithms

    • 4.2 Sorting in nlogn operations

    • 4.3 Applications of sorting

    • 4.4 Lower bound for the number of comparisons

    • 4.5 Problems related to sorting

  • 5 Finite-state algorithms in text processing

    • 5.1 Compound symbols, comments, etc.

    • 5.2 Numbers input

  • 6 Data types

    • 6.1 Stacks

    • 6.2 Queues

    • 6.3 Sets

    • 6.4 Priority queues

  • 7 Recursion

    • 7.1 Examples

    • 7.2 Trees: recursive processing

    • 7.3 The generation of combinatorial objects; search

    • 7.4 Other applications of recursion

  • 8 Recursive and non-recursive programs

    • 8.1 Table of values (dynamic programming)

    • 8.2 Stack of postponed tasks

    • 8.3 Difficult cases

  • 9 Graph algorithms

    • 9.1 Shortest paths

    • 9.2 Connected components, breadth- and depth-first search

  • 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

  • 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

  • 12 Optimal coding

    • 12.1 Codes

    • 12.2 The Kraft–McMillan inequality

    • 12.3 Huffman code

    • 12.4 Shannon–Fano code

  • 13 Set representation. Hashing

    • 13.1 Hashing with open addressing

    • 13.2 Hashing using lists

  • 14 Sets, trees, and balanced trees

    • 14.1 Set representation using trees

    • 14.2 Balanced trees

  • 15 Context-free grammars

    • 15.1 General parsing algorithm

    • 15.2 Recursive-descent parsing

    • 15.3 Parsing algorithm for LL(1)-grammars

  • 16 Left-to-right parsing (LR)

    • 16.1 LR-processes

    • 16.2 LR(0)-grammars

    • 16.3 SLR(1)-grammars

    • 16.4 LR(1)-grammars, LALR(1)-grammars

    • 16.5 General remarks about parsing algorithms

  • Further reading

  • Appendix: C and Pascal examples

  • Index

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,

Ngày đăng: 12/03/2017, 20:58

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN