出版時間:2010-8 出版社:人民郵電出版社 作者:[美] Jon Bentley 頁數(shù):239
Tag標簽:無
前言
計算機編程有很多方面。Fred Brooks在《人月神話》一書中為我們描繪了全景,他的文章強調(diào)了管理在大型軟件項目中所起的關鍵作用。而Steve McConnell在《代碼大全》一書中更具體地傳授了良好的編程風格。這兩本書所討論的是好軟件的關鍵因素和專業(yè)程序員應有的特征。遺憾的是,僅僅熟練地運用這些可靠的工程原理,不見得一定能夠如期完成軟件并順利運行。關于本書本書描述了計算機編程更具魅力的一面:在可靠的工程之外,在洞察力和創(chuàng)造力范圍內(nèi)結晶而出的編程珠璣。正如自然界中的珍珠來自干磨礪牡蠣的細沙一樣,這些編程珠璣來自于磨礪程序員的實際問題。書中的程序都很有趣,傳授了重要的編程技巧和基本的設計原理。本書大部分內(nèi)容最初發(fā)表在《ACM通訊》中我主持的“編程珠璣”專欄。這些內(nèi)容經(jīng)過匯總和修訂,在1986年結集出版,成為了本書的第1版。第1版的13篇文章中,有12篇都在本版中做了大幅修訂;此外,本版還補充了3篇新的內(nèi)容。閱讀本書只需要讀者具有某種高級語言的編程經(jīng)驗。書中偶爾會出現(xiàn)一些高級技術(如C++中的模板等),對此不熟悉的讀者可以跳過這些內(nèi)容,基本上不影響閱讀。本書每一章都獨立成篇,各章之間卻又有著邏輯分組。第1章至第5章構成本書的第一部分,這部分回顧了編程的基本原理:問題定義、算法、數(shù)據(jù)結構以及程序驗證和測試。第二部分圍繞效率這個主題展開。效率問題有時本身就很重要,又永遠都是進入有趣編程問題的絕佳跳板。第三部分用這些技術來解決排序、搜索和字符串等重要問題。閱讀本書的一個提示:不要讀得太快。要仔細閱讀,一次讀一章。要嘗試解答書中提出的問題——有些問題需要集中精力思考一兩個小時才會想清楚。然后,要努力解答每章末尾的習題:當讀者寫下答案時,從本書學到的大部分知識就會躍然紙上。
內(nèi)容概要
本書是計算機科學方面的經(jīng)典名著。書的內(nèi)容圍繞程序設計人員面對的一系列實際問題展開。作者Jon Bentley以其獨有的洞察力和創(chuàng)造力,引導讀者理解這些問題并學會解決方法,而這些正是程序員實際編程生涯中至關重要的。本書的特色是通過一些精心設計的有趣而又頗具指導意義的程序,對實用程序設計技巧及基本設計原則進行了透徹而睿智的描述,為復雜的編程問題提供了清晰而完備的解決思路。本書對各個層次的程序員都具有很高的閱讀價值。
作者簡介
作者:(美國)本特利(Jon Bentley)本特利,Jon Bentley,1953年2月20日出生于美國加州長灘。1974年畢業(yè)于斯坦福大學數(shù)學系,1976年獲北卡羅來納大學博士學位。他先后任職于卡內(nèi)基-梅隆大學(1976-1982)、貝爾實驗室(1982-2001)和Avaya實驗室(2001年至今)。在卡內(nèi)基-梅隆大學任教期間。他培養(yǎng)了許多后來知名的計算機大家。包括Scribe的開發(fā)者Brian Reid,Tcl語言設計者John Ousterhout,Java專家Joshua Bloch,Java語言設計者James Gosling,《算法導論》作者之——Charles Leiserson。2004年榮獲Dr. Dobb’s程序設計卓越獎。
書籍目錄
Part I: PRELIMINARIES Column 1: Cracking the Oyster A Friendly Conversation·Precise Problem Statement·Program Design·Implementation Sketch·Principles·Problems·Further ReadingColumn 2: Aha! Algorithms Three Problems·Ubiquitous Binary Search·The Power of Primitives·Getting It Together: Sorting·Principles·Problems·Further Reading·Implementing an Anagram ProgramColumn 3: Data Structures Programs A Survey Program·Form-Letter Programming·An Array of Examples·Structuring Data·Powerful Tools for Specialized Data·Principles·Problems·Further ReadingColumn 4: Writing Correct Programs The Challenge of Binary Search·Writing the Program·Understanding the Program·Principles·The Roles of Program Verification·Problems·Further ReadingColumn 5: A Small Matter of Programming From Pseudocode to C·A Test Harness·The Art of Assertion·Automated Testing·Timing·The Complete Program·Principles·Problems·Further Reading·DebuggingPart II: PERFORMANCE Column 6: Perspective on Performance A Case Study·Design Levels·Principles·Problems·Further ReadingColumn 7: The Back of the Envelope Basic Skills·Performance Estimates·Safety Factors·Little's Law·Principles·Problems·Further Reading·Quick Calculations in Everyday LifeColumn 8: Algorithm Design Techniques The Problem and a Simple Algorithm·Two Quadratic Algorithms·A Divide-and-Conquer Algorithm·A Scanning Algorithm·What Does It Matter?·Principles·Problems·Further ReadingColumn 9: Code Tuning 7 A Typical Story·A First Aid Sampler·Major Surgery——Binary Search·Principles·Problems·Further ReadingColumn 10: Squeezing Space The KeySimplicity·An Illustrative Problem·Techniques for Data Space·Techniques for Code Space·Principles·Problems·Further Reading·A Big SqueezePart III: THE PRODUCT Column 11: Sorting 115 Insertion Sort·A Simple Quicksort·Better Quicksorts·Principles·Problems·Further ReadingColumn 12: A Sample Problem The Problem·One Solution·The Design Space·Principles·Problems·Further ReadingColumn 13: Searching The Interface·Linear Structures·Binary Search Trees·Structures for Integers·Principles·Problems·Further Reading·A Real Searching ProblemColumn 14: Heaps The Data Structure·Two Critical Functions·Priority Queues·A Sorting Algorithm·Principles·Problems·Further ReadingColumn 15: Strings of Pearls Words·Phrases·Generating Text·Principles·Problems·Further ReadingEpilog to the First Edition Epilog to the Second Edition Appendix 1: A Catalog of Algorithms Appendix 2: An Estimation Quiz Appendix 3: Cost Models for Time and Space Appendix 4: Rules for Code Tuning Appendix 5: C++ Classes for Searching Hints for Selected Problems Solutions to Selected Problems Index
章節(jié)摘錄
插圖:Algorithm Tuning. The simple algorithm always uses small time steps to handle the rare case that two particles come close to one another. The tree data structure allows such pairs to be recognized and handled by a special function. That doubles the time step size and thereby halves the run time of the program.Data Structure Reorganization. The tree that represents the initial set of objects is quite poor at representing later sets. Reconfiguring the data structure at each time step costs a little time, but reduces the number of local calculations and thereby halves the total run time.Code Tuning. Due to additional numerical accuracy provided by the tree, 64-bitdouble-precision floating point numbers could be replaced by 32-bit single-precision numbers; that change halved the run time. Profiling the program showed that 98 percent of the run time was spent in one function; rewriting that code in assembly language increased its speed by a factor of 2.5.Hard ware. After all the above changes, the program still required two days of time on a departmental machine that cost a quarter of a million dollars, and several runs of the program were desired. Appel therefore moved the program to a slightly more expensive machine equipped with a floating point accelerator, which halved its run time again.
媒體關注與評論
“《編程珠璣》第1版是對我職業(yè)生涯早期影響最大的一本書。其中的許多真知灼見多年之后仍然使我受益匪淺。Jon在第2版中對素材進行了大量更新。許多新內(nèi)容讓我耳目一新?!薄 猄teve McConnell,《代碼大全》作者“對每一位遇到的程序員,我都會毫不遲疑地建議他閱讀并不斷重讀這部經(jīng)典之作?!薄 猄lashdot
編輯推薦
多年以來。當程序員們推選出最心愛的計算機圖書時,《編程珠璣》總是位于前列。正如自然界里珍珠出自細沙對牡蠣的磨礪.計算機科學大師Jon Bentley以其獨有的洞察力和創(chuàng)造力,從磨礪程序員的實際問題中凝結出一篇篇不朽的編程“珠璣”。這些文章是《ACM通訊》最受歡迎的專欄文章,最終結集為兩部書出版?!毒幊讨榄^(英文版·第2版)》為第一卷。主要討論計算機科學中最本質(zhì)的問題:如何正確選擇和高效地實現(xiàn)算法。在書中,作者選取許多具有典型意義的復雜編程和算法問題。生動描繪了歷史上眾多大師們在探索解決方案中發(fā)生的軼事、走過的彎路和不斷精益求精的歷程。引導讀者開展創(chuàng)新性的思考。書中透徹闡述和總結了許多獨特而精妙的設計原則、思考和解決問題的方法以及實用程序設計技巧。解決方案的代碼均以C/C++語言編寫,不僅有趣。而且有很大的實戰(zhàn)示范意義。每章后所附習題極具挑戰(zhàn)性和啟發(fā)性,書末給出了簡潔的解答。
圖書封面
圖書標簽Tags
無
評論、評分、閱讀與下載