Analysis of Algorithms O Hm

Total Page:16

File Type:pdf, Size:1020Kb

Analysis of Algorithms O Hm DESIGN AND ANALYSIS OOF ALGORITHMSHMPress Associatesociateciate versProfessorProfP Department of Informationformatio Science and Technology Collegee off EngineeEngiEngineering, Guindy Campus Anna UniversityUnUniversity, Chennai Oxford ΞKdžĨŽƌĚhŶŝǀĞƌƐŝƚLJWƌĞƐƐ͘ůůƌŝŐŚƚƐƌĞƐĞƌǀĞĚ͘ Oxford University Press is a department of the University of Oxford. It furthers the University’s objective of excellence in research, scholarship, and education by publishing worldwide. Oxford is a registered trade mark of Oxford University Press in the UK and in certain other countries. Published in India by Oxford University Press YMCA Library Building, 1 Jai Singh Road, New Delhi 110001, India © Oxford University Press 2014 The moral rights of the author/s have been asserted. First published in 2014 All rights reserved. No part of this publication may be reproduced,ed, storestored in a retrieval system, or transmitted, in any form or by any means,ns, withoutwithou the prior permission in writing of Oxford University Press, or as expresslypressly permittedpe by law, by licence, or under terms agreed with the appropriatepriateiate reproreprographics rights organization. Enquiries concerning reproduction outside the scope of the above should be sent to the Rights Department, Oxfordo d UniversityUniversi Press, at the address above. Press You must not circulate this workk in any otheroth form and you must impose this same conditionndition on anany acquirer. ISBN-13: 978-0-19-809369-5-0-19-809369-519-80936 ISBN-10:: 0-19-809369-1-19-80936 Typesetet in Times New Roman by Idealall PublishingPublishin SSolutions, Delhi Printed in Indiandia by RadhaRad Press, New Delhi 110031 Third-party websiteebsiteite aaddressesdressesdres mentioned in this book are provided by Oxford Universityversity PPressUniversityss in good faith and for information only. Oxford University Press disclaimdisclaims any responsibility for the material contained therein. Oxford ΞKdžĨŽƌĚhŶŝǀĞƌƐŝƚLJWƌĞƐƐ͘ůůƌŝŐŚƚƐƌĞƐĞƌǀĞĚ͘ Features of the Book CHAPTER Introducon to 1 Topical Coverage Algorithms CHAPTER The book provides extensive coverage of Basics of ComputaƟonal ƚŽƉŝĐƐƐƚĂƌƟŶŐĨƌŽŵ 18 CHAPTER Complexity ĂůŐŽƌŝƚŚŵďĂƐŝĐƐĂŶĚ ĚĂƚĂƐƚƌƵĐƚƵƌĞƐ͕ŵŽǀŝŶŐ Data Structures—I 5 ŽŶƚŽĚŝīĞƌĞŶƚĂůŐŽƌŝƚŚŵ CHAPTER design techniques, “Bad programmers worry about the code. Good programmers worry about data structures followed by discussions Greedy Algorithms ŽŶĐŽŵƉƵƚĂƟŽŶĂů 11 ĐŽŵƉůĞdžŝƟĞƐĂŶĚWZD “Greed is all right,CHAPTER by the way...TER I think greed is healthy. You can be greedy ĂůŐŽƌŝƚŚŵƐ͘ d till f lss d b t lf ” Dynamic Programming 13 Press y 11.8.1 MŝŶŝŵƵŵ SƉĂŶŶŝŶŐ TƌĞĞƐ Treatment of Concepts The history of an MST is as interesting as its concept. In 1926, Otakerer Boruvka formulatedformulaformers ^ŝŵƉůĞĂŶĚůŽŐŝĐĂů the MST problem. A Polish mathematician, Vojtech Jarnik, describedbedd the problemprobl in 1929 ĞdžƉůĂŶĂƟŽŶƐŽĨĐŽŶĐĞƉƚƐ in a letter to Otaker Boruvka. The same problem was conceiveded independentlyndependen by Kruskal in 1956. +ence, Kruskal rediscovered the problem. /ater it wasas de¿ned independently indepi by are provided using Robert Prim in 1957 and by Edsger Dijkstra in 1958 Example 11.1211.12 Consider the graph G shownsh wn in Fig.Fig 11.11. Construct an MST for the ĞƐƐĞŶƟĂůŵĂƚŚĞŵĂƟĐĂů given graph G using Kruskal’s algorithm. UniversityUn ĞdžƉƌĞƐƐŝŽŶƐ͕ŝůůƵƐƚƌĂƟŽŶƐ͕ 6ROXWLRQ The ¿rst step in Kruskal’s algorithmlgorithm is to sort all the edges and form an edge list, ĂŶĚŶƵŵĞƌŽƵƐƐŽůǀĞĚ say E. The edges of graph G shown in Fig. 11.2111.2 are sorted and shown in Table 11.13. ĞdžĂŵƉůĞƐ͘ŝīĞƌĞŶƚ ŽŵƉůĞdžŝƚLJŶĂůLJƐŝƐŽĨ<ƌƵƐŬĂů͛ƐůŐŽƌŝƚŚŵŚŵ ƚLJƉĞƐŽĨƉƌŽďůĞŵƐĂůŽŶŐ Since the disjoint set data structure is used,ed, initialiinitializationordor takes at most (|V|) time. The time complexity of the algorithm dependsends on the numnumber of edges. As there are |E| edges, O(| E ǁŝƚŚƚŚĞŝƌĂůŐŽƌŝƚŚŵƐ͕ |log| E |) time is required to sortt these edgeedges. The disjoint set takes at most 2| E | ¿nd opera- ĞdžĂŵƉůĞƐ͕ĂŶĚĐŽŵƉůĞdžŝƚLJ tions and |V |í1 operations. Therefore,refore, theth total complexity of Kruskal’s algorithm is at most O(| E |log| E |) time. OxforO ĂŶĂůLJƐĞƐĂƌĞŐŝǀĞŶ͘ AlgoritŚm PresentaƟon ůŐŽƌŝƚŚŵƐĂƌĞƉƌĞƐĞŶƚĞĚ Step 1: Create a node x by allocating memory for it. in two ways, that is, step- Step 2: Assign the required value to the item part of node x. wise approach;ŝŶĨŽƌŵĂů item(x) = value Step 3: Set in the pointer to null. ƌĞƉƌĞƐĞŶƚĂƟŽŶͿĂŶĚ next(x) = null pseudocode approach Step 4: ReturnAlgorithm the node x . create(L, x, value) ;ĨŽƌŵĂůƌĞƉƌĞƐĞŶƚĂƟŽŶͿ %% Input: List L and element x with 'value' ĨŽƌƉƌŽǀŝĚŝŶŐĂďĞƩĞƌ %% Output: Node x Begin understanding of the allot(x) %% Allot memory for node x with two ºeldsŹitem and next item(x) = value logic behind solving a next(x) = null ŐŝǀĞŶƉƌŽďůĞŵǁŝƚŚŽƵƚ ƵƐŝŶŐĂŶLJƐƉĞĐŝĮĐ ƉƌŽŐƌĂŵŵŝŶŐůĂŶŐƵĂŐĞ͘ ΞKdžĨŽƌĚhŶŝǀĞƌƐŝƚLJWƌĞƐƐ͘ůůƌŝŐŚƚƐƌĞƐĞƌǀĞĚ͘ Historical Notes Box 1.1 Origin of the word ‘algorithm’ The word algorithm is derived from the name of a Persian Europe. He also introduced the simple step-b Historical notes are mathematician, Abu Ja’fer Mohammed Ibn Musa al for addition, subtraction, multiplication, and provided throughout the Khowarizmi, who lived sometime around 780–850 AD. He his book. The word algebra has also been d was from the town of Khowarazm, now in Uzbekistan. He the title of this book. When his book was t ŬĂƐƐĞƉĂƌĂƚĞďŽdžĞƐ͘ was a teacher of mathematicsBox 17.2 inGeorge Baghdad. Bernard He wrote Dantzig a book Latin, his name was quoted as Algorismus dŚĞLJƉƌŽǀŝĚĞĂĚĚŝƟŽŶĂů *eorge Bernard Dantzig was born in 1914 at Portland, duality theory. He worked with Fulkerson an Oregon, United States. His father became a professor of in formulating the travelling salesperson pro ŝŶĨŽƌŵĂƟŽŶƌĞůĂƚĞĚƚŽ mathematics at University of Maryland after World War linear programming and solved the TSP proble II. Dantzig’s biggest contribution is that he designed the 49 cities at that time. In 197, he was award ƚŚĞĐŽŶĐĞƉƚƐĚŝƐĐƵƐƐĞĚ͘ simplex method for solving LPPs. Apart from the simplex National Medal of Science, the highest honou Glossary and Summary Q GLOSSARY Q ŐůŽƐƐĂƌLJŽĨŬĞLJƚĞƌŵƐ Agent A performer of an algorithm $OJRULWKPYHUL¿FDWLRQ The process of provid ĂůŽĂůŽŶŐǁŝƚŚĚĞĮŶŝƟŽŶƐĂŶĚ Algorist A person who is skilled in algorithm development cal proof that the algorithm works correctly f Algorithm A step-by-step procedure for solving a given Algorithm validation The process of chec ĂƉŽŝĂƉŽŝŶƚͲǁŝƐĞƐƵŵŵĂƌLJŝƐ problem ness of an algorithm, this is done by givin givgiven at the end of each Algorithm gap The difference between lower and upper it and checking its results with expected Q SUMMARY Q esesschapter to help readers An algorithm is a step-by-step procedure for solving a Algorithm veri¿cation is a processes of proprovv ƌĞĐĂƉŝƚƵůĂƚĞƚŚĞŝŵƉŽƌƚĂŶƚ given problem. ematical proof that the givenn algorithmalgorithorit wwoo ĐŽŶĐĞƉƚƐĞdžƉůĂŝŶĞĚ͘ A computational problem is characterized by two for all instances of data. PresP factors²speci¿cation of valid input and output param- A proof of an algorithmm is said to existexis if t ity Revieǁ YuesƟons͕ iversityiv Q REVIEW QUESTIONS Q Edžercises͕ and 1.1 De¿ne ann algorithm. 1.8 What is the difference between algo 1.2 Whatat are the characteristicschar of an algorithm" and algorithm validation" AddiƟonal Proďlems 1.3 SurveyS y the InternetInte and list out at least ¿ve algorithms 1.9 How is an algorithm validated and EƵŵĞƌŽƵƐƌĞǀŝĞǁ that have Univhugeh impact on our daily lives. with an example. 1.44 What area the stages of problem solving" 1.10 State algorithm classi¿cations. Wha ƋƵĞƐƟŽŶƐ͕ĞdžĞƌĐŝƐĞƐ͕ĂŶĚ Q EXERCISES Q 1.1 Assume that there are two algorithms A and B for a complexities of A, B, and C are 3n ĂĚĚŝƟŽŶĂůĐŽŶĐĞƉƚͲďĂƐĞĚ rd given problem P. The time complexity functions of algo- respectively. Assume that the input i ƉƌŽďůĞŵƐĂƌĞŐŝǀĞŶĂƚ rithms A and B are, respectively, 5n and log2n. Which Assume that the machine executes algorithm should be selected assuming that all other per second. How much time will algo the end of every chapterpter f conditions remain the same for both the problems" C take" Which algorithm will be the Q ADDITIONAL PROBLEM Q to test the readers’er 12 L h f l h di h 1.1 John MacCormick had written a book titled Nine recognition, data compression, datab conceptual knowledgegeOxfordOx Algorithms That Changed the Future: The Ingenious signatures, that changed the world. Ideas that drive Today’s Computers, Princeton University (a) What are these algorithms" Se and also enhance their Press, Princeton, that had listed the nine wonderful and ¿nd what these algorithms ĂůŐŽƌŝƚŚŵǁƌŝƟŶŐƐŬŝůůƐ͘ algorithms, namely, search engine indexing, page rank, (b) Identify one more algorithm that Q CROSSWORD Q 1 Crossword Puzzles 2 Crossword puzzles, 3 45 ŐŝǀĞŶĂƐĂŶĞdžĐŝƟŶŐĂŶĚ ŝŶƚĞƌĂĐƟǀĞůĞĂƌŶŝŶŐ exercise at the end of each 7 8 ĐŚĂƉƚĞƌ͕ŵŽƟǀĂƚĞĂŶĚĂŝĚ 910 readers to self-check their ƵŶĚĞƌƐƚĂŶĚŝŶŐ͘ 11 ΞKdžĨŽƌĚhŶŝǀĞƌƐŝƚLJWƌĞƐƐ͘ůůƌŝŐŚƚƐƌĞƐĞƌǀĞĚ͘ WƌĞĨĂĐĞ Computers have become an integral part of our daily life in recent times. They have enormously impacted our personal, professional, as well as social lives. Computers help us in tasks such as document editing, Internet browsing, sending emails, making presentations, performing complex scienti¿c computations, social networking, and playing games. Industries and government of¿ces use computers effectively in production, e-governance, and e-commerce. Considering the increasing demand of computers in society, schools, colleges, and universities have included computer education in their curriculum, to help students become
Recommended publications
  • Average-Case Analysis of Algorithms and Data Structures L’Analyse En Moyenne Des Algorithmes Et Des Structures De DonnEes
    (page i) Average-Case Analysis of Algorithms and Data Structures L'analyse en moyenne des algorithmes et des structures de donn¶ees Je®rey Scott Vitter 1 and Philippe Flajolet 2 Abstract. This report is a contributed chapter to the Handbook of Theoretical Computer Science (North-Holland, 1990). Its aim is to describe the main mathematical methods and applications in the average-case analysis of algorithms and data structures. It comprises two parts: First, we present basic combinatorial enumerations based on symbolic methods and asymptotic methods with emphasis on complex analysis techniques (such as singularity analysis, saddle point, Mellin transforms). Next, we show how to apply these general methods to the analysis of sorting, searching, tree data structures, hashing, and dynamic algorithms. The emphasis is on algorithms for which exact \analytic models" can be derived. R¶esum¶e. Ce rapport est un chapitre qui para^³t dans le Handbook of Theoretical Com- puter Science (North-Holland, 1990). Son but est de d¶ecrire les principales m¶ethodes et applications de l'analyse de complexit¶e en moyenne des algorithmes. Il comprend deux parties. Tout d'abord, nous donnons une pr¶esentation des m¶ethodes de d¶enombrements combinatoires qui repose sur l'utilisation de m¶ethodes symboliques, ainsi que des tech- niques asymptotiques fond¶ees sur l'analyse complexe (analyse de singularit¶es, m¶ethode du col, transformation de Mellin). Ensuite, nous d¶ecrivons l'application de ces m¶ethodes g¶enerales a l'analyse du tri, de la recherche, de la manipulation d'arbres, du hachage et des algorithmes dynamiques.
    [Show full text]
  • Design and Analysis of Algorithms Credits and Contact Hours: 3 Credits
    Course number and name: CS 07340: Design and Analysis of Algorithms Credits and contact hours: 3 credits. / 3 contact hours Faculty Coordinator: Andrea Lobo Text book, title, author, and year: The Design and Analysis of Algorithms, Anany Levitin, 2012. Specific course information Catalog description: In this course, students will learn to design and analyze efficient algorithms for sorting, searching, graphs, sets, matrices, and other applications. Students will also learn to recognize and prove NP- Completeness. Prerequisites: CS07210 Foundations of Computer Science and CS04222 Data Structures and Algorithms Type of Course: ☒ Required ☐ Elective ☐ Selected Elective Specific goals for the course 1. algorithm complexity. Students have analyzed the worst-case runtime complexity of algorithms including the quantification of resources required for computation of basic problems. o ABET (j) An ability to apply mathematical foundations, algorithmic principles, and computer science theory in the modeling and design of computer-based systems in a way that demonstrates comprehension of the tradeoffs involved in design choices 2. algorithm design. Students have applied multiple algorithm design strategies. o ABET (j) An ability to apply mathematical foundations, algorithmic principles, and computer science theory in the modeling and design of computer-based systems in a way that demonstrates comprehension of the tradeoffs involved in design choices 3. classic algorithms. Students have demonstrated understanding of algorithms for several well-known computer science problems o ABET (j) An ability to apply mathematical foundations, algorithmic principles, and computer science theory in the modeling and design of computer-based systems in a way that demonstrates comprehension of the tradeoffs involved in design choices and are able to implement these algorithms.
    [Show full text]
  • Introduction to the Design and Analysis of Algorithms
    This page intentionally left blank Vice President and Editorial Director, ECS Marcia Horton Editor-in-Chief Michael Hirsch Acquisitions Editor Matt Goldstein Editorial Assistant Chelsea Bell Vice President, Marketing Patrice Jones Marketing Manager Yezan Alayan Senior Marketing Coordinator Kathryn Ferranti Marketing Assistant Emma Snider Vice President, Production Vince O’Brien Managing Editor Jeff Holcomb Production Project Manager Kayla Smith-Tarbox Senior Operations Supervisor Alan Fischer Manufacturing Buyer Lisa McDowell Art Director Anthony Gemmellaro Text Designer Sandra Rigney Cover Designer Anthony Gemmellaro Cover Illustration Jennifer Kohnke Media Editor Daniel Sandin Full-Service Project Management Windfall Software Composition Windfall Software, using ZzTEX Printer/Binder Courier Westford Cover Printer Courier Westford Text Font Times Ten Copyright © 2012, 2007, 2003 Pearson Education, Inc., publishing as Addison-Wesley. All rights reserved. Printed in the United States of America. This publication is protected by Copyright, and permission should be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. To obtain permission(s) to use material from this work, please submit a written request to Pearson Education, Inc., Permissions Department, One Lake Street, Upper Saddle River, New Jersey 07458, or you may fax your request to 201-236-3290. This is the eBook of the printed book and may not include any media, Website access codes or print supplements that may come packaged with the bound book. Many of the designations by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed in initial caps or all caps.
    [Show full text]
  • Algorithms and Computational Complexity: an Overview
    Algorithms and Computational Complexity: an Overview Winter 2011 Larry Ruzzo Thanks to Paul Beame, James Lee, Kevin Wayne for some slides 1 goals Design of Algorithms – a taste design methods common or important types of problems analysis of algorithms - efficiency 2 goals Complexity & intractability – a taste solving problems in principle is not enough algorithms must be efficient some problems have no efficient solution NP-complete problems important & useful class of problems whose solutions (seemingly) cannot be found efficiently 3 complexity example Cryptography (e.g. RSA, SSL in browsers) Secret: p,q prime, say 512 bits each Public: n which equals p x q, 1024 bits In principle there is an algorithm that given n will find p and q:" try all 2512 possible p’s, but an astronomical number In practice no fast algorithm known for this problem (on non-quantum computers) security of RSA depends on this fact (and research in “quantum computing” is strongly driven by the possibility of changing this) 4 algorithms versus machines Moore’s Law and the exponential improvements in hardware... Ex: sparse linear equations over 25 years 10 orders of magnitude improvement! 5 algorithms or hardware? 107 25 years G.E. / CDC 3600 progress solving CDC 6600 G.E. = Gaussian Elimination 106 sparse linear CDC 7600 Cray 1 systems 105 Cray 2 Hardware " 104 alone: 4 orders Seconds Cray 3 (Est.) 103 of magnitude 102 101 Source: Sandia, via M. Schultz! 100 1960 1970 1980 1990 6 2000 algorithms or hardware? 107 25 years G.E. / CDC 3600 CDC 6600 G.E. = Gaussian Elimination progress solving SOR = Successive OverRelaxation 106 CG = Conjugate Gradient sparse linear CDC 7600 Cray 1 systems 105 Cray 2 Hardware " 104 alone: 4 orders Seconds Cray 3 (Est.) 103 of magnitude Sparse G.E.
    [Show full text]
  • From Analysis of Algorithms to Analytic Combinatorics a Journey with Philippe Flajolet
    From Analysis of Algorithms to Analytic Combinatorics a journey with Philippe Flajolet Robert Sedgewick Princeton University This talk is dedicated to the memory of Philippe Flajolet Philippe Flajolet 1948-2011 From Analysis of Algorithms to Analytic Combinatorics 47. PF. Elements of a general theory of combinatorial structures. 1985. 69. PF. Mathematical methods in the analysis of algorithms and data structures. 1988. 70. PF L'analyse d'algorithmes ou le risque calculé. 1986. 72. PF. Random tree models in the analysis of algorithms. 1988. 88. PF and Michèle Soria. Gaussian limiting distributions for the number of components in combinatorial structures. 1990. 91. Jeffrey Scott Vitter and PF. Average-case analysis of algorithms and data structures. 1990. 95. PF and Michèle Soria. The cycle construction.1991. 97. PF. Analytic analysis of algorithms. 1992. 99. PF. Introduction à l'analyse d'algorithmes. 1992. 112. PF and Michèle Soria. General combinatorial schemas: Gaussian limit distributions and exponential tails. 1993. 130. RS and PF. An Introduction to the Analysis of Algorithms. 1996. 131. RS and PF. Introduction à l'analyse des algorithmes. 1996. 171. PF. Singular combinatorics. 2002. 175. Philippe Chassaing and PF. Hachage, arbres, chemins & graphes. 2003. 189. PF, Éric Fusy, Xavier Gourdon, Daniel Panario, and Nicolas Pouyanne. A hybrid of Darboux's method and singularity analysis in combinatorial asymptotics. 2006. 192. PF. Analytic combinatorics—a calculus of discrete structures. 2007. 201. PF and RS. Analytic Combinatorics. 2009. Analysis of Algorithms Pioneering research by Knuth put the study of the performance of computer programs on a scientific basis. “As soon as an Analytic Engine exists, it will necessarily guide the future course of the science.
    [Show full text]
  • A Survey and Analysis of Algorithms for the Detection of Termination in a Distributed System
    Rochester Institute of Technology RIT Scholar Works Theses 1991 A Survey and analysis of algorithms for the detection of termination in a distributed system Lois Rixner Follow this and additional works at: https://scholarworks.rit.edu/theses Recommended Citation Rixner, Lois, "A Survey and analysis of algorithms for the detection of termination in a distributed system" (1991). Thesis. Rochester Institute of Technology. Accessed from This Thesis is brought to you for free and open access by RIT Scholar Works. It has been accepted for inclusion in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact [email protected]. Rochester Institute of Technology Computer Science Department A Survey and Analysis of Algorithms for the Detection of Termination rna Distributed System by Lois R. Romer A thesis, submitted to The Faculty of the Computer Science Department, in partial fulfillment of the requirements for the degree of Master of Science in Computer Science. Approved by: Dr. Andrew Kitchen Dr. James Heliotis "22 Jit~ 1/ Dr. Peter Anderson Date Title of Thesis: A Survey and Analysis of Algorithms for the Detection of Termination in a Distributed System I, Lois R. Rixner hereby deny permission to the Wallace Memorial Library, of RITj to reproduce my thesis in whole or in part. Date: ~ oj'~, /f7t:J/ Abstract - This paper looks at algorithms for the detection of termination in a distributed system and analyzes them for effectiveness and efficiency. A survey is done of the pub lished algorithms for distributed termination and each is evaluated. Both centralized dis tributed systems and fully distributed systems are reviewed.
    [Show full text]
  • Algorithm Analysis
    Presentation for use with the textbook, Algorithm Design and Applications, by M. T. Goodrich and R. Tamassia, Wiley, 2015 Analysis of Algorithms Input Algorithm Output © 2015 Goodrich and Tamassia Analysis of Algorithms 1 Scalability q Scientists often have to deal with differences in scale, from the microscopically small to the astronomically large. q Computer scientists must also deal with scale, but they deal with it primarily in terms of data volume rather than physical object size. q Scalability refers to the ability of a system to gracefully accommodate growing sizes of inputs or amounts of workload. © 2015 Goodrich and Tamassia Analysis of Algorithms 2 Application: Job Interviews q High technology companies tend to ask questions about algorithms and data structures during job interviews. q Algorithms questions can be short but often require critical thinking, creative insights, and subject knowledge. n All the “Applications” exercises in Chapter 1 of the Goodrich- Tamassia textbook are taken from reports of actual job interview questions. xkcd “Labyrinth Puzzle.” http://xkcd.com/246/ Used with permission under Creative Commons 2.5 License. © 2015 Goodrich and Tamassia Analysis of Algorithms 3 Algorithms and Data Structures q An algorithm is a step-by-step procedure for performing some task in a finite amount of time. n Typically, an algorithm takes input data and produces an output based upon it. Input Algorithm Output q A data structure is a systematic way of organizing and accessing data. © 2015 Goodrich and Tamassia Analysis of Algorithms 4 Running Time q Most algorithms transform best case input objects into output average case worst case objects.
    [Show full text]
  • The History of Algorithmic Complexity
    City University of New York (CUNY) CUNY Academic Works Publications and Research Borough of Manhattan Community College 2016 The history of Algorithmic complexity Audrey A. Nasar CUNY Borough of Manhattan Community College How does access to this work benefit ou?y Let us know! More information about this work at: https://academicworks.cuny.edu/bm_pubs/72 Discover additional works at: https://academicworks.cuny.edu This work is made publicly available by the City University of New York (CUNY). Contact: [email protected] The Mathematics Enthusiast Volume 13 Article 4 Number 3 Number 3 8-2016 The history of Algorithmic complexity Audrey A. Nasar Follow this and additional works at: http://scholarworks.umt.edu/tme Part of the Mathematics Commons Recommended Citation Nasar, Audrey A. (2016) "The history of Algorithmic complexity," The Mathematics Enthusiast: Vol. 13: No. 3, Article 4. Available at: http://scholarworks.umt.edu/tme/vol13/iss3/4 This Article is brought to you for free and open access by ScholarWorks at University of Montana. It has been accepted for inclusion in The Mathematics Enthusiast by an authorized administrator of ScholarWorks at University of Montana. For more information, please contact [email protected]. TME, vol. 13, no.3, p.217 The history of Algorithmic complexity Audrey A. Nasar1 Borough of Manhattan Community College at the City University of New York ABSTRACT: This paper provides a historical account of the development of algorithmic complexity in a form that is suitable to instructors of mathematics at the high school or undergraduate level. The study of algorithmic complexity, despite being deeply rooted in mathematics, is usually restricted to the computer science curriculum.
    [Show full text]
  • Algorithm Efficiency Measuring the Efficiency of Algorithms the Topic Of
    Algorithm Efficiency Measuring the efficiency of algorithms The topic of algorithms is a topic that is central to computer science. Measuring an algorithm’s efficiency is important because your choice of an algorithm for a given application often has a great impact. Word processors, ATMs, video games and life support systems all depend on efficient algorithms. Consider two searching algorithms. What does it mean to compare the algorithms and conclude that one is better than the other? The analysis of algorithms is the area of computer science that provides tools for contrasting the efficiency of different methods of solution. Notice the use of the term methods of solution rather than programs; it is important to emphasize that the analysis concerns itself primarily with significant differences in efficiency – differences that you can usually obtain only through superior methods of solution and rarely through clever tricks in coding. Although the efficient use of both time and space is important, inexpensive memory has reduced the significance of space efficiency. Thus, we will focus primarily on time efficiency. How do you compare the time efficiency of two algorithms that solve the same problem? One possible approach is to implement the two algorithms in C++ and run the programs. There are three difficulties with this approach: 1. How are the algorithms coded? Does one algorithm run faster than another because of better programming? We should not compare implementations rather than the algorithms. Implementations are sensitive to factors such as programming style that cloud the issue. 2. What computer should you use? The only fair way would be to use the same computer for both programs.
    [Show full text]
  • Bioinformatics Algorithms Techniques and Appli
    BIOINFORMATICS ALGORITHMS Techniques and Applications Edited by Ion I. Mandoiu˘ and Alexander Zelikovsky A JOHN WILEY & SONS, INC., PUBLICATION BIOINFORMATICS ALGORITHMS BIOINFORMATICS ALGORITHMS Techniques and Applications Edited by Ion I. Mandoiu˘ and Alexander Zelikovsky A JOHN WILEY & SONS, INC., PUBLICATION Copyright © 2008 by John Wiley & Sons, Inc. All rights reserved. Published by John Wiley & Sons, Inc., Hoboken, New Jersey Published simultaneously in Canada No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, 978-750-8400, fax 978-646-8600, or on the web at www.copyright.com. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201)-748-6011, fax (201)-748-6008. Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in preparing this book, they make no representations or warranties with respect to the accuracy or completeness of the contents of this book and specifically disclaim any implied warranties of merchantability or fitness for a particular purpose. No warranty may be created or extended by sales representatives or written sales materials. The advice and strategies contained herein may not be suitable for your situation.
    [Show full text]
  • A Theoretician's Guide to the Experimental Analysis of Algorithms
    A Theoretician's Guide to the Experimental Analysis of Algorithms David S. Johnson AT&T Labs { Research http://www.research.att.com/ dsj/ ∼ November 25, 2001 Abstract This paper presents an informal discussion of issues that arise when one attempts to an- alyze algorithms experimentally. It is based on lessons learned by the author over the course of more than a decade of experimentation, survey paper writing, refereeing, and lively dis- cussions with other experimentalists. Although written from the perspective of a theoretical computer scientist, it is intended to be of use to researchers from all fields who want to study algorithms experimentally. It has two goals: first, to provide a useful guide to new experimen- talists about how such work can best be performed and written up, and second, to challenge current researchers to think about whether their own work might be improved from a scientific point of view. With the latter purpose in mind, the author hopes that at least a few of his recommendations will be considered controversial. 1 Introduction It is common these days to distinguish between three different approaches to analyzing al- gorithms: worst-case analysis, average-case analysis, and experimental analysis. The above ordering of the approaches is the one that most theoretical computer scientists would choose, with experimental analysis treated almost as an afterthought. Indeed, until recently exper- imental analysis of algorithms has been almost invisible in the theoretical computer science literature, although experimental work dominates algorithmic research in most other areas of computer science and related fields such as operations research. The past emphasis among theoreticians on the more rigorous and theoretical modes of analysis is of course to be expected.
    [Show full text]
  • Design and Analysis of Algorithms Application of Greedy Algorithms
    Design and Analysis of Algorithms Application of Greedy Algorithms 1 Huffman Coding 2 Shortest Path Problem Dijkstra’s Algorithm 3 Minimal Spanning Tree Kruskal’s Algorithm Prim’s Algorithm ©Yu Chen 1 / 83 Applications of Greedy Algorithms Huffman coding Proof of Huffman algorithm Single source shortest path algorithm Dijkstra algorithm and correctness proof Minimal spanning trees Prim’s algorithm Kruskal’s algorithm ©Yu Chen 2 / 83 1 Huffman Coding 2 Shortest Path Problem Dijkstra’s Algorithm 3 Minimal Spanning Tree Kruskal’s Algorithm Prim’s Algorithm ©Yu Chen 3 / 83 Motivation of Coding Let Γ beP an alphabet of n symbols, the frequency of symbol i is fi. n Clearly, i=1 fi = 1. In practice, to facilitate transmission in the digital world (improve efficiency and robustness), we use coding to encode symbols (characters in a file) into codewords, then transmit. encoding transmit decoding Γ C C Γ What is a good coding scheme? efficiency: efficient encoding/decoding & low bandwidth other nice properties about robustness, e.g., error-correcting ©Yu Chen 4 / 83 Fix-length coding seems neat. Why bother to introduce variable-length coding? If each symbol appears with same frequency, then fix-length coding is good. If (Γ;F ) is non-uniform, we can use less bits to represent more frequent symbols ) more economical coding ) low bandwidth Fix-Length vs. Variable-Length Coding Two approaches of encoding a source (Γ;F ) Fix-length: the length of each codeword is a fixed number Variable-length: the length of each codeword could be different ©Yu Chen 5 / 83 If each symbol appears with same frequency, then fix-length coding is good.
    [Show full text]