Lecture notes on Algorithms and data structures

advanced data structures and algorithms lecture notes and algorithms and data structures interview questions, algorithms and data structures for beginners pdf free download
OscarTucker Profile Pic
OscarTucker,Singapore,Professional
Published Date:19-07-2017
Your Website URL(Optional)
Comment
COS 226, SPRING 2014 ALGORITHMS AND DATA STRUCTURES KEVIN WAYNE http://www.princeton.edu/cos226COS 226 course overview What is COS 226? Intermediate-level survey course. Programming and problem solving, with applications. Algorithm: method for solving a problem. Data structure: method to store information. topic data structures and algorithms stack, queue, bag, union-find, priority queue data types quicksort, mergesort, heapsort, radix sorts sorting BST, red-black BST, hash table searching BFS, DFS, Prim, Kruskal, Dijkstra graphs KMP, regular expressions, tries, data compression strings B-tree, k-d tree, suffix array, maxflow advanced 2Why study algorithms? Their impact is broad and far-reaching. Internet. Web search, packet routing, distributed file sharing, ... Biology. Human genome project, protein folding, … Computers. Circuit layout, file system, compilers, … Computer graphics. Movies, video games, virtual reality, … Security. Cell phones, e-commerce, voting machines, … Multimedia. MP3, JPG, DivX, HDTV, face recognition, … Social networks. Recommendations, news feeds, advertisements, … Physics. N-body simulation, particle collision simulation, … ⋮ 3Why study algorithms? Their impact is broad and far-reaching. 4Why study algorithms? Old roots, new opportunities. Study of algorithms dates at least to Euclid. Formalized by Church and Turing in 1930s. Some important algorithms were discovered by undergraduates in a course like this 5 300 BCE 1920s 1930s 1940s 1950s 1960s 1970s 1980s 1990s 2000sWhy study algorithms? For intellectual stimulation. FR O M T H E ED ITOR S THE JOY OF ALGORITHMS Francis Sullivan, Associate Editor-in-Chief HE THEME OF THIS FIRST-OF-THE-CENTURY ISSUE OF COMPUTING IN “ For me, great algorithms are the poetry of computation. Just T SCIENCE & ENGINEERING IS ALGORITHMS. IN FACT, WE WERE BOLD ENOUGH—AND PERHAPS FOOLISH ENOUGH—TO CALL THE 10 EXAMPLES WE’VE SE- LECTED “THE TOP 10 ALGORITHMS OF THE CENTURY.” Computational algorithms are probably as old as civilization. mysterious. But once unlocked, they cast a brilliant new light Sumerian cuneiform, one of the most ancient written records, on some aspect of computing. A colleague recently claimed consists partly of algorithm descriptions for reckoning in base that he’d done only 15 minutes of productive work in his 60. And I suppose we could claim that the Druid algorithm for whole life. He wasn’t joking, because he was referring to the like verse, they can be terse, allusive, dense, and even mysterious. estimating the start of summer is embodied in Stonehenge. 15 minutes during which he’d sketched out a fundamental op- (That’s really hard hardware) timization algorithm. He regarded the previous years of Like so many other things that technology affects, algo- thought and investigation as a sunk cost that might or might rithms have advanced in startling and unexpected ways in the not have paid off. 20th century—at least it looks that way to us now. The algo- Researchers have cracked many hard problems since 1 Jan- rithms we chose for this issue have been essential for progress uary 1900, but we are passing some even harder ones on to the in communications, health care, manufacturing, economics, next century. In spite of a lot of good work, the question of weather prediction, defense, and fundamental science. Con- how to extract information from extremely large masses of versely, progress in these areas has stimulated the search for data is still almost untouched. There are still very big chal- ever-better algorithms. I recall one late-night bull session on lenges coming from more “traditional” tasks, too. For exam- the Maryland Shore when someone asked, “Who first ate a ple, we need efficient methods to tell when the result of a large crab? After all, they don’t look very appetizing.’’ After the usual floating-point calculation is likely to be correct. Think of the But once unlocked, they cast a brilliant new light on some speculations about the observed behavior of sea gulls, someone way that check sums function. The added computational cost gave what must be the right answer—namely, “A very hungry is very small, but the added confidence in the answer is large. person first ate a crab.” Is there an analog for things such as huge, multidisciplinary The flip side to “necessity is the mother of invention’’ is “in- optimizations? At an even deeper level is the issue of reason- vention creates its own necessity.’’ Our need for powerful ma- able methods for solving specific cases of “impossible’’ prob- chines always exceeds their availability. Each significant com- lems. Instances of NP-complete problems crop up in at- putation brings insights that suggest the next, usually much tempting to answer many practical questions. Are there larger, computation to be done. New algorithms are an attempt efficient ways to attack them? to bridge the gap between the demand for cycles and the avail- I suspect that in the 21st century, things will be ripe for an- able supply of them. We’ve become accustomed to gaining the other revolution in our understanding of the foundations of Moore’s Law factor of two every 18 months. In effect, Moore’s computational theory. Questions already arising from quan- Law changes the constant in front of the estimate of running tum computing and problems associated with the generation aspect of computing. ” — Francis Sullivan time as a function of problem size. Important new algorithms of random numbers seem to require that we somehow tie to- do not come along every 1.5 years, but when they do, they can gether theories of computing, logic, and the nature of the change the exponent of the complexity physical world. For me, great algorithms are the poetry of computation. The new century is not going to be very restful for us, but it Just like verse, they can be terse, allusive, dense, and even is not going to be dull either 2 C O MPUTIN G IN SCIEN CE & EN GINEERIN G “ An algorithm must be seen to be believed. ” — Donald Knuth 6Why study algorithms? To become a proficient programmer. “ I will, in fact, claim that the difference between a bad programmer and a good one is whether he considers his code or his data structures more important. Bad programmers worry about the code. Good programmers worry about data structures and their relationships. ” — Linus Torvalds (creator of Linux) “ Algorithms + Data Structures = Programs. ” — Niklaus Wirth 7Why study algorithms? They may unlock the secrets of life and of the universe. “ Computer models mirroring real life have become crucial for most advances made in chemistry today…. Today the computer is just as important a tool for chemists as the test tube. ” — Royal Swedish Academy of Sciences (Nobel Prize in Chemistry 2013) Martin Karplus, Michael Levitt, and Arieh Warshel 8Why study algorithms? To solve problems that could not otherwise be addressed. http://www.youtube.com/watch?v=ua7YlN4eL_w 9Why study algorithms? Everybody else is doing it. % sort -rn PU2013-14.txt 774 COS 126 General Computer Science 615 ECO 100 Introduction to Microeconomics 471 ECO 101 Introduction to Macroeconomics 444 ENG 385 Children's Literature 440 MAT 202 Linear Algebra with Applications 414 COS 226 Algorithms and Data Structures 405 MAT 201 Multivariable Calculus 384 CHV 310 Practical Ethics 344 REL 261 Christian Ethics and Modern Society 320 PSY 101 Introduction to Psychology 300 COS 217 Introduction to Programming Systems ... 10Why study algorithms? For fun and profit. 11Why study algorithms? Their impact is broad and far-reaching. Old roots, new opportunities. For intellectual stimulation. To become a proficient programmer. They may unlock the secrets of life and of the universe. To solve problems that could not otherwise be addressed. Everybody else is doing it. For fun and profit. Why study anything else? 12Lectures Traditional lectures. Introduce new material. Electronic devices. Permitted, but only to enhance lecture. no no no What When Where Who Office Hours see web L01 MW 11–12:20 McCosh 10 Kevin Wayne 13Lectures Traditional lectures. Introduce new material. Flipped lectures. Watch videos online before lecture. Complete pre-lecture activities. Attend only one "flipped" lecture per week (interactive, collaborative, experimental). Apply via web ASAP: results by 5pm today. What When Where Who Office Hours see web L01 MW 11–12:20 McCosh 10 Kevin Wayne 14 Josh Hug see web Frist 307 W 11–12:20 L02 Andy GunaPrecepts Discussion, problem-solving, background for assignments. What When Where Who Office Hours see web P01 Th 11–11:50 CS 102 Andy Guna † see web P02 Th 12:30–1:20 Bobst 105 Andy Guna † see web P03 Th 1:30–2:20 Bobst 105 Nevin Li see web P04 F 10–10:50 Bobst 105 Jennifer Guo see web P05 F 11–11:50 Bobst 105 Madhu Jayakumar see web P05A F 11–11:50 Sherrerd 001 Ruth Dannenfelser see web P06 F 2:30–3:20 Friend 108 Chris Eubank see web P06A F 2:30–3:20 Friend 111 TBA see web P06B F 2:30–3:20 Friend 109 Josh Hug † see web P07 F 3:30–4:20 Friend 108 Josh Hug † likely to change † lead preceptor 15Coursework and grading Programming assignments. 45% Due on Tuesdays at 11pm via electronic submission. Collaboration/lateness policies: see web. Exercises. 10% Due on Sundays at 11pm in Blackboard. Collaboration/lateness policies: see web. Exams. 15% + 30% Final Midterm (in class on Wednesday, March 12). Programs Final (to be scheduled by Registrar). Midterm Staff discretion. adjust borderline cases Report errata. Exercises Contribute to Piazza discussion forum. Attend and participate in precept/lecture. 16Resources (textbook) th Required reading. Algorithms 4 edition by R. Sedgewick and K. Wayne, Addison-Wesley Professional, 2011, ISBN 0-321-57351-X. Algorithms FOUR TH EDITION st nd rd 1 edition (1982) 2 edition (1988) 3 edition (1997) RO B E R T SEDGEWICK K EVIN W AY N E th 4 edition (2011) rd 3 book scanned by Google books Available in hardcover and Kindle. Online: Amazon (60/35 to buy), Chegg (25 to rent), ... Brick-and-mortar: Labyrinth Books (122 Nassau St). On reserve: Engineering library. 17Resources (web) Course content. Course info. Lecture slides. Flipped lectures. Programming assignments. Exercises. http://www.princeton.edu/cos226 Exam archive. Booksite. Brief summary of content. Download code from book. APIs and Javadoc. http://algs4.cs.princeton.edu 18Resources (web) http://www.princeton.edu/cos226 19Resources (web) http://www.princeton.edu/cos226 20

Advise: Why You Wasting Money in Costly SEO Tools, Use World's Best Free SEO Tool Ubersuggest.