Computer Science 1001.py. Lecture 25 On P vs. NP: Graphs, Maps, and Coloring; Simulating Gravity; Concluding Remarks and Famous Last Words

Size: px
Start display at page:

Download "Computer Science 1001.py. Lecture 25 On P vs. NP: Graphs, Maps, and Coloring; Simulating Gravity; Concluding Remarks and Famous Last Words"

Transcription

1 Computer Science 1001.py Lecture 25 On P vs. NP: Graphs, Maps, and Coloring; Simulating Gravity; Concluding Remarks and Famous Last Words Instructors: Benny Chor, Amir Rubinstein Teaching Assistants: Yael Baran, Michal Kleinbort Founding Teaching Assistant (and Python Guru): Rani Hod School of Computer Science Tel-Aviv University, Spring Semester,

2 Lecture 24, Topics Covered Undecidability of the halting problem. 2 out of 2 secret sharing. Visual secret sharing (2 out of 2). 2 / 64

3 Lecture 25, Plan Graphs, Maps, and Coloring. Simulating gravity the n body problem. Concluding remarks and farewell. 3 / 64

4 And Now for Something Completely Different: Into the Heart of Darkness A glimpse into maps, graph, coloring, computational complexity, and the theory of NP completeness. (Cover of Joseph Conrad s book Heart of Darkness. source: here) 4 / 64

5 Basic notions in Graph Theory G = (V, E) a a V nodes, E edges (pairs of nodes) Classification: undirected (left) directed (right) non weighted edges (both) weighted edges G = (V, E, w) (not shown) unique edges (both) vs. multiple edges (Königsberg, below) c c b b d d G = ( {a,b,c,d}, { (a,b),(a,c),(c,c) } ) Notions: neighbor, neighborhood, degree path, cycle, connectivity Euler paths problem 7 bridges of Königsberg conditions for Euler path/cycle 2

6 Possible Representations of a Graph Possible representations of graphs in the computer's memory: 0 1 a b 2 c G=[ [0,1,1,1], [1,0,1,0], [1,1,0,0], [1,0,0,0] ] Adjacency Matrix 3 G=[ [1,2,3], [0,2], [1,0], [0] ] Neighbors list when nodes are not labeled, we number them arbitrarily 0,1,,n-1 G=[(a,b),(a,c), (a,d),(b,c)] List of edges (this representation does not show isolated nodes) d G={ a:[b,c,d], b:[a,c], c:[b,a], d:[a] } Neighbors list as a dictionary when nodes have "names" (labeled) 3 How would directionalities on edges affect each representation? What about weights?

7 קשה, אבל קל לאימות verify) (easy to מחלקת הבעיות הקשות מכילה בעיות שלא ידוע להם פתרון פולינומי. חלק מבעיות אלו מקיימות תכונה מעניינת: אם נקבל לידנו פתרון חוקי, יש לנו דרך יעילה* לאמת )verify( אותו. דוגמה בה נעסוק: צביעה חוקית של מפות ושל גרפים )הדגמה על הלוח(. ארתור לא יודע איך למצוא צביעה חוקית במספר נתון של צבעים אבל אם מרלין יציע לו צביעה ויטען כי היא חוקית, ארתור )חשדן מטבעו( יוכל לאמת זאת בקלות )כי בדיקת חוקיות היא קלה(. * שוב, יעיל = בזמן פולינומי 6

8 Verification of Coloring: Python code def verify_color(g,c): """ verify that C is a legal coloring of the graph G. G is represented as a list of undirected edges. C is a dictionary with nodes as keys and colors as values """ A = {edge[0] for edge in G} B = {edge[1] for edge in G} nodes = A.union(B) coloring_nodes = set(c) # set of nodes in coloring if not nodes == coloring_nodes: # equal sets of nodes print("nodes in G and in C do not match") print(nodes) print(coloring_nodes) return False else: for edge in G: a,b = edge[0], edge[1] if C[a] == C[b]: print("illegal coloring of edge ", edge) return False print("legal coloring") return True 7

9 צביעת מפות )עוד הדגמות על הלוח( להלן מפת מדינות: נגדיר צביעה חוקית של מפה: צביעה של כל מדינה בצבע אחד, כך שאין שתי מדינות גובלות באותו צבע. שאלות: האם ניתן לצבוע את המפה הזו ב- 2 צבעים? - 3 צבעים? - 4 צבעים? - האם תוכלו לתת בכל מקרה דוגמה הפוכה: - מפה שלא ניתן לצבוע אותה ב- 2 צבעים? ב- 3? ב- 4? )מתוך האתר "מדעי המחשב ללא מחשב",.) 11

10 צביעת מפות מפה ניתנת לייצוג באמצעות גרף. ייצוג והכללה צמתים = קשתות = המדינות בין צמתים שמייצגים שתי מדינות גובלות תהיה קשת וכיצד נייצג צביעה של גרף ב- k צבעים? התאמה של כל צומת למספר טבעי k,,1. ננסח את השאלות מהשקף הקודם באופן כללי, וכשאלת הכרעה )כן/לא(: בהינתן גרף ומספר k, האם ניתן לצבוע את הגרף באמצעות k צבעים בלבד? 12

11 צביעת מפות 2 צבעים תנאי להיותו של גרף 2 -צביע )2-colorable( גרף ניתן לצביעה ב- 2 צבעים אם ורק אם אין בו מעגלים באורך איזוגי. גרף כזה מכונה גם גרף דו-צדדי.)Bipartite( אלגוריתם לבדיקה אם גרף נתון הוא 2 -צביע: נצבע צומת שרירותי כלשהו בצבע אדום. נצבע את כל שכניו בכחול, את כל שכני שכניו שוב באדום, וכך הלאה. אם בשלב כלשהו אנו נתקלים בשכן שכבר צבוע באותו הצבע, נחזיר "לא". 13 אחרת נחזיר "כן".

12 צביעת מפות ב- 2 צבעים: דרגת קושי שאלה: מה דרגת הקושי של הבעיה "האם גרף ניתן לצביעה ב- 2 צבעים"? האלגוריתם עובר על כל צומת ועל כל קשת פעם אחת. אם הגרף מיוצג כמטריצה )m-by-m( הסיבוכיות ליניארית בגודל הייצוג לכן זוהי בעיה קלה: יש לה פתרון יעיל )פולינומי באורך הייצוג של גרף הקלט( שאלה: האם בעיית מציאת הצביעה ב- 2 צבעים, במקרה שיש כזו, היא בעיה קלה? 14 אבחנה: "האם ניתן" התשובה היא כן/לא היא בעיית הכרעה. "מציאת צביעה" )או גורם ראשוני/מעריך בחזקה/הצבה בנוסחא( היא בעיית חיפוש.

13 גרף מישורי לפני שנדון בתוצאה רלוונטית מפורסמת, נשים לב לתכונה הבאה: גרף שמייצג מפה מישורית ניתן לשרטוט כאשר אף קשת לא חותכת אף קשת אחרת. גרף כזה נקרא גרף מישורי graph(.)planar 15

14 צביעה של גרף מישורי משפט ארבעת הצבעים: כל גרף מישורי ניתן לצביעה ב- 4 צבעים. בשנת 1852 צעיר בריטי בשם פרנסיס גאתרי ניסח זאת כהשערה, אחרי שהבחין כי מפת המחוזות (shires) של אנגליה )וגם סקוטלנד( היא 4 צביעה. 16

15 צביעה ב- 4 צבעים של גרף מישורי שאלה: מתי גרף מישורי הוא 4 -צביע )4-colorable(? תשובה מפתיעה: תמיד! משפט ארבעת הצבעים: כל גרף מישורי ניתן לצביעה ב- 4 צבעים. בשנת 1852 צעיר בריטי בשם פרנסיס גאתרי ניסח זאת כהשערה, אחרי שהבחין כי מפת המחוזות (shires) של אנגליה היא 4 צביעה. 17 במשך למעלה מ- 120 שנה טובי המתמטיקאים בעולם ניסו להוכיח את השערת ארבעת הצבעים, ללא הצלחה. המשפט הוכח בשנת ההוכחה מראה שניתן לסווג כל מפה לאחת מ סוגי מפות. אחד מצעדי ההוכחה כולל בחינת כאלפיים סוגים אלו, באמצעות מחשב. ההוכחה התפרשה על יותר מ- 500 עמודים. ההוכחה הייתה שנויה במחלוקת זמן רב )מ"בחינה פילוסופית"(. מדוע? מה דעתכם? עד היום לא ידועה הוכחה ללא עזרת מחשב! יש הוכחות )פשוטות( ל- 6 צביעה ול- 5 צביעה של גרפים מישוריים ללא שימוש במחשב.

16 צביעה ב- 4 צבעים של גרף מישורי שאלה: מתי גרף מישורי הוא 4 -צביע )4-colorable(? תשובה מפתיעה: תמיד! משפט ארבעת הצבעים: כל גרף מישורי ניתן לצביעה ב- 4 צבעים. שאלה: לאיזו קטגוריה שייכת הבעיה "האם גרף מישורי ניתן לצביעה ב- 4 צבעים"? תשובה: על פי המשפט הנ"ל, זוהי בעיה טריוויאלית. בודקים שהגרף מישורי )זה קל אם נתון "שיכון מישורי" שלו(, ועונים "כן". יש אלגוריתם שרץ בזמן ריבועי )בגודל גרף הקלט( וצובע גרף מישורי ב- 4 צבעים )זו "בעיית החיפוש"(. בעייה זו היא קלה, אך אינה טריוויואלית. 18 בעיה קשורה היא בעיית ההכרעה הבאה: בהנתן גרף מישורי, האם הוא 3 צביע. בעיה זו אינה קלה.

17 האם צביעה היא בעייה קלה? לא ידוע כיום אלגוריתם יעיל שעונה "כן"/"לא" לשאלה: בהינתן גרף כלשהו, האם ניתן לצבוע אותו ב- 3 צבעים? ב- 4 צבעים? ב- 7 צבעים? 19

18 האם צביעה היא בעייה קלה? לא ידוע כיום אלגוריתם יעיל שעונה "כן"/"לא" לשאלה: בהינתן גרף כלשהו, האם ניתן לצבוע אותו ב- 3 צבעים? ב- 4 צבעים? ב- 7 צבעים? 20

19 צביעה ניתנת לאימות יעיל לא ידוע כיום אלגוריתם יעיל שעונה "כן"/"לא" לשאלה: בהינתן גרף כלשהו, האם ניתן לצבוע אותו ב- 3 צבעים? 21

20 צביעה ניתנת לאימות יעיל לא ידוע כיום אלגוריתם יעיל שעונה "כן"/"לא" לשאלה: בהינתן גרף כלשהו, האם ניתן לצבוע אותו ב- 7 צבעים? 22

21 האם? P=NP מחלקת הבעיות הקלות מסומנת )Polynomial time( P מחלקת הבעיות הקשות מסומנת (Non-deterministic polynomial time( NP קצרה היריעה, אין מקום בשוליים... אז לא נסביר בכתב... בקורס "מודלים חישוביים" תיכנסו לעבי הקורה. מה היחס בין שתי המחלקות הללו? הסבר קצרצר ודיון. NP P=NP P? = 23 השאלה הפתוחה הגדולה של מדעי המחשב התיאורטיים )הפרס - מיליון דולר וגם תהילת עולם(: האם היכולת לוודא ביעילות פתרון של בעיה, מעידה על יכולת לפתור אותה ביעילות? האם?P=NP

22 And Now for Something Completely Different: The N Body Problem and Gravity Simulation Outer planets trajectories, as seen from above. Source: JPL, Solar System 22 / 64

23 The N Body Problem and Gravity Simulation Consider two solid celestial bodies (stars, planets, astroids, comet, etc.) 1, 2 in 3D space. Suppose their masses are m 1, m 2, respecfully, and the distance between their centers of mass is r, r > 0. Newton s law of gravity syates that the gravitational force attracting them to each other equals F 1,2 = G m 1 m 2 r 2 Its direction in space is exactly towards the other body. G = is the gravitational constant (an absolute constant, holding for all gravitational Newtonian system in our universe). Masses are in kilograms, time in seconds, distances are in meters. Note that if the distance approaches zero, r 0, the magnitude of the gravitational force grows to infinity, F 1,2. 23 / 64

24 The N Body Problem and Gravity Simulation, cont. For more than two bodies, m 1, m 2,..., m N, N > 2, the gravitational force on each m i is the sum of all individual forces applied to it, for all i j, F j,i. j, j i To fully specify such gravitational system, we should specify the mass of each body, as well as its initial conditions at time zero, namely location and velocity of each body. 24 / 64

25 Basic Newtonian Mechanics Newton s second law states that the acceleration of each body equals the sum of forces exerted on it, divided by its mass, a = F /m. Acceleration is the derivative of velocity, v, with respect to time, namely d v a =. dt In turn, velocity is the derivative of location, s, with respect to time, namely v = d s. dt 25 / 64

26 A System of Differential Equations Taking into account the relation between gravitational force and location, we get a system of differential equations, where the variables are the locations of the N objects, s 1, s 2,..., s N. For two body systems, m 1, m 2, there are closed form and well understood analytical solutions (essentially quadratic curves). However, for N 3, the general N body system has no analytical, closed form solutions. 26 / 64

27 Numerical Approaches to the Rescue Analytical solutions are preferable, bit for for N 3 they simply do not exist (it is not just a matter of being computationally infeasible). What is typically being done is to identify a time step, t, which is small enough so that within this time step, the velocity of each body remains approximately constant. Consider the time sequence t 0, t 1 = t + t, t 1 = t + 2 t,..., t i = t + i t,... We compute the force at each t i, and from this derive the acceleration, the velocity in the time interval t i, t i+1, and the location at the following time step, t i+1. This is the starting point for the next step in the iteration, and so on. 27 / 64

28 Numerical Approaches to the Rescue, cont. The smallest the time step, t, is, the more accurate the piecewise approximation will be. On the other hand, this would require more calculations. For a standard solar planet system, t being one day is a good choice. For galactic systems, t being one day is way too short. For folding proteins, t should be a few nanoseconds (in fact, in such systems it is not just gravity, there are various chemical forces involved). We use a modification of a Python code by A.M. Kuchling, The original code simulated mother Earth and Venus circling the good old Sun. We modified the parameters so that wilder trajectories are developing. We note that our system is just in 2D. Python s turtle graphics is used to view the trajectories. 28 / 64

29 A Four Body Example: Screenshot of anti anti gravity.py Execusion A green sun, three planets whose mass is one hundredth (1/100) of the sun (each). Blue and brown escape, sun moves left, red trapped. 29 / 64

30 And Now for Something Completely Different: Review of Notions Covered During the Course The following 15 slides provide a reasonably good coverage of major high level notions dealt with in the course. These notions and slides certainly do not exhaust all major issues we studied, nor do they touch upon final details of any topic. This review is provided to help you when studying on your own towards the exam. It certainly does not replace a good understanding of fine grained details. 30 / 64

31 Computational Problems and Algorithms Two central notions in most CS courses What is a computational problem? A mapping input output What is an algorithm? A solution to a computational problem A series of operations that transforms input to output. What is an operation? Context dependent Levels of resolution: electron level bit level integer level (add, mult, read, write, compare, ) data structure level (list sort, matrix mult, tree insert) button click in a GUI 12

32 Algorithms In what ways can one describe an algorithm? Code (formal, in some programming language) Pseudo-code: less formal, but avoids the technical details Natural language (Hebrew, Arabic, Russian, Swahili, ) Flow diagram Animation Video Implementation of an algorithm A concrete mechanism capable of executing the algorithm (e.g. code) Execution of an algorithm Specific machine(s) at a specific time 13

33 Algorithmic Approaches Throughout the course, you have been exposed to several algorithmic approaches. When facing some computational problem, one should take into consideration these approaches, each with its pros and cons. Or invent a new approach 14

34 Iterative Algorithms Algorithms are not limited to a linear sequence of operations they usually include control structures. A basic control structure is the loop(an even more basic one is the conditional if). In low level languages (assembly), a loop is implemented with a goto statement. Most high-level programming languages include while and for loops. In Python, forloops are somewhat safer, as they are normally used to iterate over finite collections. This is not the case in all languages 15

35 Complexity A important measure for an algorithm's efficiency Time complexity number of operations / concrete time measurement as a function of the input size Space complexity maximalnumber of memory cells allocated simultaneously at any specific step of the algorithm as a function of inputsize Recall the key difference between time and space: time cannot be reused. The O( ) notation a convenient formalization of complexity asymptotic correlates to "rate of growth" rather than absolute number of operations hides multiplicative constants and negligible additives 16 n 0 t(n)= O(g(n)) c g(n) t(n)

36 Complexity of Iterative Algorithms Basic iterative patterns (c is some constant independent of n): 1. i = 1 1. i = 1 1. i = n O(n) 2. while i < n: 2. while i < n: 2. while i > 1: (c >0) 3. i = i i = i + c 3. i = i - c 1. i = 1 1. i = 1 1. i = n O(logn) 2. while i < n: 2. while i < n: 2. while i > 1: (c >1) 3. i = i*2 3. i = i*c 3. i = i / c O(???) 1. i = 2 2. while i < n: 3. i = i * i 1. i = 2 2. while i < n: 3. i = i**c 1. i = n 2. while i > 2: 3. i = i**1/c Things get more complicated when we have nested loops that are dependent, as we have seen in many occasions throughout the course. 17 (c >1)

37 Worst / Best Case Complexity In many cases, for the same size of input, the content of the input itself affects the complexity. Examples we have seen? Examples in which this is not the case? Note that this statement is completely illogical: "The best time complexity is when n is very small " Often the averagecomplexity is more informative (e.g. when the worst case is rather rare). However analyzing it is usually more complicated, and requires some knowledge on the distribution of inputs. T ( I ) Assuming distribution is uniform: Taverage ( n) = I Input ( n) Input( n) 18 examples from our course? - hash operation are O(1) on average (not including comparing/hashing elements) - Quicksort runs on average in O(nlogn) (also best case)

38 Recursive Algorithms Divide Conquer Join Solve smaller instances of the problem and join them Tips: 1. First define the recursion step: think about only 1level of the recursion. Then adjust the appropriate base conditions 2. If subproblems repeat, consider memoization to speedup solution Recursive algorithms seen in our course: Lectures: - Fibonacci, n!, binary search (also seen iterative), Quicksort, Mergesort, Hanoi, 8 queens, binary tree stuff Recitations: - Binom, the "change" problem, maximum (several versions), HW: - munch (ahhm, chomp), 19

39 Recursion Trees A useful tool for understanding and analyzing recursion. Recall the Fibonacci recursion tree analysis: O(n/2) O(n) Each node requires O(1) time. = c( n-1 ) = c(2 n -1) = O(2 n ) 20 = c( (n/2)-1 ) = c(2 n/2-1) = O(2 n/2 ) = O( 2 n )

40 Recurrence Relations Another, more compact and formal description of recursive processes is recurrence relations. Recall the formula for Quicksort's best case t(n) = 2t(n/2) + O(n) This allows easy categorization of the recursive "pattern": how many recursive calls? of what size each? how much time beyond recursion (for the divide and join stages) 21

41 Recursive Formulae Summary דוגמא Max1 (מהתרגול), עצרת פעולות מעבר לרקורסיה קריאות רקורסיביות נוסחת נסיגה T(N)=1+T(N-1) סיבוכיות O(N) N-1 1 O(log N) T(N)=1+T(N/2) N/2 חיפוש בינארי 1 O(N 2 ) T(N)=N+ T(N-1) N-1 N Quicksort (worst case) O(N log N) T(N)=N+2T(N/2) N/2,N/2 N Mergesort Quicksort (best case) O(N) T(N)=N+T(N/2) N/2 N חיפוש בינארי עם slicing O(N) T(N)=1+2T(N/2) N/2,N/2 max2 (מהתרגול) 1 O(2 N ) T(N)=1+2T(N-1) N-1, N-1 1 האנוי ) N O(2 (לא הדוק) T(N)=1+T(N-1)+T(N-2) N-1, N-2 1 פיבונאצ'י 22

42 23 Randomized Algorithms

43 Greedy Algorithms Do what's best now! Do not look at the larger "picture" The simple version of Ziv-Lempelcompression that we have learned is greedy. HW6: is this justified in terms of compression efficiency? Huffman tree construction is also greedy. Greediness does notnecessarily pay off (computationally speaking) 24 image from Wikipedia

44 Parallel / Distributed Algorithms Parallel if 2 subtasks are independent, solve them at the same time by 2 computers Distributed several computing units interact with each other, but there is no high level "manager". In parallel computing there is a central computing unit that acts as the "manager"of the whole process 25 Dictatorship Democracy

45 "Brute Force" Algorithms Brute force, or exhaustivealgorithms, simply "try out" all possible solutions. When the number of possible solutions is exponential, we do our best to avoid such algorithms. 26

46 And Now to Something Completely Different: A Brief Voyage Back in Time End of the Road Songs - by Leah Goldberg Let us go back to Sunday, March 8, / 64

47 Travel Advisory You are about to take a new version of the extended introduction to CS course. This is the sixth run of this course. It is intended primarily for first year Computer Science students. The programming language taught and used in the course is Python (version 3.x). The course will require a substantial amount of work by yourselves to digest and pass successfully. Welcome aboard! 47 / 64

48 Administrative Details Grade determined by exam (70-80%) and homework (30-20%). In order to pass the course, you must pass the exam (grade at least 60), and also get a non failing grade (at least 50) in all home assignments. Homework grade is a weighted average of all n home assignments grades: Equal weight to the best n 1 grades, plus half the weight for the one worst grade. Moed A exam will be on July 16th, 2015 (Moed B on August 20th). Exam is closed book except for 2 double sided, normal size (A4) pages. 48 / 64

49 Course Structure We will sample different topics of interest from a fairly wide range in Computer Science. This should hopefully expose you to some of the beautiful topics and ideas in the field. Naturally we will not get into any of them in great depth. We leave this to the required and elective courses you will take later in your studies. Each topic will be accompanied by programming examples (given by us) and tasks (to be done by you). Lectures and recitations are coordinated and both form integral parts of the course. Lectures in the same day by both lecturers are in principle the same, as are the 4 recitations (by the two teaching assistants) on the same week. 49 / 64

50 Programming Aspects This is not a programming course. Yet, you will learn and use a specific programming language Python. And basic ideas in programming like iteration, control structure, recursion, procedures, objects, basic data structures, etc. etc. Python is a relatively new programming language, gaining popularity in many applications. Those of you who heard about Scheme and were hoping to learn it here, are two years late :-( 50 / 64

51 One More Thing this Course is Not About 51 / 64

52 Course Topics (tentative list, not in order, somewhat ambitious) Python programming basics (2 3 meetings) Bits, bytes, and representation of numbers in the computer. Huge integers, with applications to public key cryptography. Sorting and Searching. Basic data structures, incl. hashing and hash functions. Numerical computations (Newton Raphson root finding). String matching, with applications in computational biology. Text compression. Representing and manipulating images. Simple error correction codes. Problems that cannot be solved by any computer Hard computational problems. 52 / 64

53 Course Topics (what we did cover not a complete list) Python programming basics (2 3 meetings) Bits, bytes, and representation of numbers in the computer. Huge integers, with applications to public key cryptography. Sorting and Searching. Basic data structures, incl. hashing and hash functions. Numerical computations (Newton Raphson root finding). String matching, with applications in computational biology. Text compression. Representing and manipulating images. Simple error correction codes. Problems that cannot be solved by any computer Hard computational problems. Pollard s ρ algorithm/heuristic for integer factoring. Games: Munch; Eight queens. Secret sharing. Simulating a physical (gravitational) system. 53 / 64

54 More Course Topics (What we did cover not a complete list either) Lists slicing and list comprehension. Immutable and mutable objects. Floating point numbers. Recursion and memoization. Higher order functions. Defining functions using lambda expressions. Computational complexity: Basic notions. Big O notation. Binary vs. unary representation. Sets and dictionaries; Iterators and generators. Object oriented programming (classes and methods). Volume bounds for error correction codes. Random number generation; Timing operations; Synthetic images. 54 / 64

55 What Lies Ahead: 2nd and 3rd Year CS Courses Software 1 Data Structures Algorithms Software Project Computational Models Computers Structure Operating Systems Complexity Logic Compilation Probability and Statistics Elective courses 55 / 64

56 Plan for the Rest of the Course A few words about the dreaded exam Two short advertisements. Thanks. Famous last words. 56 / 64

57 The Dreaded Exam All material covered in class, recitations, and homework, from all parts of course. Both multiple choice ( semi closed ) and open questions. Including some coding ( dry coding ) and/or fixing bugs in given code. Make sure you verbally explain your code. You can bring and use two double sided A4 (normal size) pages. If we deem some details are required, we ll supply them. Do not waste effort and memory trying to memorize obscure details. But knowledge of basic ones (e.g. slicing, list comprehension, binary search, classes, etc., etc.) is expected. Piece of cake. 57 / 64

58 Advice for Preparing to the Dreaded Exam Prioritize! Concentrate on the ideas, not the gory details. Identify important details that you do not memorize, and write down a summary in the 2 double sided pages. You are expected to know the details of algorithms taught in the lectures, recitations, and designed by you in homework. We do not expect you to memrize any code. Relax! 58 / 64

59 Topics Not Included in the Dreaded Exam Group Theory. Ackermann function. Representation of floating point numbers. Finite state automata and their use in string matching. Files I/O. Pollard s ρ algorithm/heuristic for integer factoring. P vs. NP. The halting problem. The N body problem. Everything labeled for reference only. As already advertized: Piece of cake. 59 / 64

60 Short Advertisement (1): Teaching Computer Science in the community (for 2nd and 3rd year students) Your chance to spread your knowledge to school kids (typically mid school, ages 12-15). A challenging and personally rewarding activity. 60 / 64

61 ) Short Advertisement (2): Student exchange (2nd year + סמסטר בוונציה אוניברסיטת תל - אביב תלמידים לתואר הראשון באוניברסיטת תל - אביב מוזמנים ללמוד במשך סמסטר אחד באוניברסיטה הבינלאומית של ונציה Venice International University (VIU) בקורסים בתחומים הבאים )שפת ההוראה אנגלית( : היסטוריה, תיאוריה של האמנות, תולדות האמנות, תקשורת, אדריכלות, לימודי דתות, תורת הספרות, סוציולוגיה, מדע המדינה, כלכלה, איטלקית מדוברת ההרשמה לסמסטר א' תשע"ב היא עד 30/04/2011 ולסמסטר ב' תשע"ב - עד 15/11/2011 מידע על הכרה בקורסים של VIU יינתן על - ידי החוגים / הפקולטות למספר תלמידים מצטיינים שהרשמתם תאושר יוענקו מלגות בסך 800$ כל אחת לגבי פרטים על ההרשמה, שכר הלימוד, המגורים ומידע נוסף נא לפנות אל אבי זרכובסקי, המזכירות האקדמית, בניין הסנאט ע"ש ג'ורג' ס' וייז, חדר 202 בימים א' - הי, בין השעות,10:00-13:00 טלפון, : דואל zaravi@post.tau.ac.il : VIU is just one attractive example out of many options. For a full list of universities with whom TAU has a student exchange agreement, look at the site of TAU office of international academic affairs, or send to acadaff@tauex.tau.ac.il. 61 / 64

62 Many Thanks To the many people who taught us about topics we were not familiar with, and gave us feedback and advice about earlier versions of the course material and slides (too many to list individually). To the previous lecturers and teaching assistants in the course, who greatly helped improving it (again, too many to list individually). To the students in the course who contributed pieces of code, error reports, and constructive criticism. To the founding teaching assistant, the one and only Rani Hod. To this term s teaching assistants, Michal Kleinbort, and Yael Baran, and to this term s less senior lecturer, Amir Runinstein, for being such a great team. Without them, this course would not be possible! 62 / 64

63 Famous Last Words You have brains in your head. You have feet in your shoes. You can steer yourself any direction you choose. You re on your own. And you know what you know. And YOU are the guy who ll decide where to go. 63 / 64

64 Famous Last Words You have brains in your head. You have feet in your shoes. You can steer yourself any direction you choose. You re on your own. And you know what you know. And YOU are the guy who ll decide where to go. By Theodor Seuss Geisel (aka Dr. Suess, ). Hebrew translation by Leah Naor. For an alternative version of the book Oh, the places you ll go, by Dr. Seuss, as told by the people of Burning Man 2011, turn to youtube. For a version in Hebrew, here at the heart of Tel-Aviv, see another youtube piece. in English only. The Gujarati version was, ahmm, lost in translation. thanks to Noam Parzanchevski for the reference. 64 / 64

Why? A central concept in Computer Science. Algorithms are ubiquitous.

Why? A central concept in Computer Science. Algorithms are ubiquitous. Analysis of Algorithms: A Brief Introduction Why? A central concept in Computer Science. Algorithms are ubiquitous. Using the Internet (sending email, transferring files, use of search engines, online

More information

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8]

2. (a) Explain the strassen s matrix multiplication. (b) Write deletion algorithm, of Binary search tree. [8+8] Code No: R05220502 Set No. 1 1. (a) Describe the performance analysis in detail. (b) Show that f 1 (n)+f 2 (n) = 0(max(g 1 (n), g 2 (n)) where f 1 (n) = 0(g 1 (n)) and f 2 (n) = 0(g 2 (n)). [8+8] 2. (a)

More information

SIMS 255 Foundations of Software Design. Complexity and NP-completeness

SIMS 255 Foundations of Software Design. Complexity and NP-completeness SIMS 255 Foundations of Software Design Complexity and NP-completeness Matt Welsh November 29, 2001 mdw@cs.berkeley.edu 1 Outline Complexity of algorithms Space and time complexity ``Big O'' notation Complexity

More information

CSC148 Lecture 8. Algorithm Analysis Binary Search Sorting

CSC148 Lecture 8. Algorithm Analysis Binary Search Sorting CSC148 Lecture 8 Algorithm Analysis Binary Search Sorting Algorithm Analysis Recall definition of Big Oh: We say a function f(n) is O(g(n)) if there exists positive constants c,b such that f(n)

More information

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92.

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) 3 4 4 7 5 9 6 16 7 8 8 4 9 8 10 4 Total 92. Name: Email ID: CSE 326, Data Structures Section: Sample Final Exam Instructions: The exam is closed book, closed notes. Unless otherwise stated, N denotes the number of elements in the data structure

More information

Efficiency of algorithms. Algorithms. Efficiency of algorithms. Binary search and linear search. Best, worst and average case.

Efficiency of algorithms. Algorithms. Efficiency of algorithms. Binary search and linear search. Best, worst and average case. Algorithms Efficiency of algorithms Computational resources: time and space Best, worst and average case performance How to compare algorithms: machine-independent measure of efficiency Growth rate Complexity

More information

Lecture 07: Work and Kinetic Energy. Physics 2210 Fall Semester 2014

Lecture 07: Work and Kinetic Energy. Physics 2210 Fall Semester 2014 Lecture 07: Work and Kinetic Energy Physics 2210 Fall Semester 2014 Announcements Schedule next few weeks: 9/08 Unit 3 9/10 Unit 4 9/15 Unit 5 (guest lecturer) 9/17 Unit 6 (guest lecturer) 9/22 Unit 7,

More information

Computer programming course in the Department of Physics, University of Calcutta

Computer programming course in the Department of Physics, University of Calcutta Computer programming course in the Department of Physics, University of Calcutta Parongama Sen with inputs from Prof. S. Dasgupta and Dr. J. Saha and feedback from students Computer programming course

More information

Algorithms. Margaret M. Fleck. 18 October 2010

Algorithms. Margaret M. Fleck. 18 October 2010 Algorithms Margaret M. Fleck 18 October 2010 These notes cover how to analyze the running time of algorithms (sections 3.1, 3.3, 4.4, and 7.1 of Rosen). 1 Introduction The main reason for studying big-o

More information

VISUAL ALGEBRA FOR COLLEGE STUDENTS. Laurie J. Burton Western Oregon University

VISUAL ALGEBRA FOR COLLEGE STUDENTS. Laurie J. Burton Western Oregon University VISUAL ALGEBRA FOR COLLEGE STUDENTS Laurie J. Burton Western Oregon University VISUAL ALGEBRA FOR COLLEGE STUDENTS TABLE OF CONTENTS Welcome and Introduction 1 Chapter 1: INTEGERS AND INTEGER OPERATIONS

More information

Lecture 7: NP-Complete Problems

Lecture 7: NP-Complete Problems IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NP-Complete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit

More information

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge, cheapest first, we had to determine whether its two endpoints

More information

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:

Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation: CSE341T 08/31/2015 Lecture 3 Cost Model: Work, Span and Parallelism In this lecture, we will look at how one analyze a parallel program written using Cilk Plus. When we analyze the cost of an algorithm

More information

2010-2011 Assessment for Master s Degree Program Fall 2010 - Spring 2011 Computer Science Dept. Texas A&M University - Commerce

2010-2011 Assessment for Master s Degree Program Fall 2010 - Spring 2011 Computer Science Dept. Texas A&M University - Commerce 2010-2011 Assessment for Master s Degree Program Fall 2010 - Spring 2011 Computer Science Dept. Texas A&M University - Commerce Program Objective #1 (PO1):Students will be able to demonstrate a broad knowledge

More information

SYSM 6304: Risk and Decision Analysis Lecture 5: Methods of Risk Analysis

SYSM 6304: Risk and Decision Analysis Lecture 5: Methods of Risk Analysis SYSM 6304: Risk and Decision Analysis Lecture 5: Methods of Risk Analysis M. Vidyasagar Cecil & Ida Green Chair The University of Texas at Dallas Email: M.Vidyasagar@utdallas.edu October 17, 2015 Outline

More information

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering

Engineering Problem Solving and Excel. EGN 1006 Introduction to Engineering Engineering Problem Solving and Excel EGN 1006 Introduction to Engineering Mathematical Solution Procedures Commonly Used in Engineering Analysis Data Analysis Techniques (Statistics) Curve Fitting techniques

More information

Lecture 10: Regression Trees

Lecture 10: Regression Trees Lecture 10: Regression Trees 36-350: Data Mining October 11, 2006 Reading: Textbook, sections 5.2 and 10.5. The next three lectures are going to be about a particular kind of nonlinear predictive model,

More information

Recursive Algorithms. Recursion. Motivating Example Factorial Recall the factorial function. { 1 if n = 1 n! = n (n 1)! if n > 1

Recursive Algorithms. Recursion. Motivating Example Factorial Recall the factorial function. { 1 if n = 1 n! = n (n 1)! if n > 1 Recursion Slides by Christopher M Bourke Instructor: Berthe Y Choueiry Fall 007 Computer Science & Engineering 35 Introduction to Discrete Mathematics Sections 71-7 of Rosen cse35@cseunledu Recursive Algorithms

More information

Florida Math for College Readiness

Florida Math for College Readiness Core Florida Math for College Readiness Florida Math for College Readiness provides a fourth-year math curriculum focused on developing the mastery of skills identified as critical to postsecondary readiness

More information

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015 CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Today Registration should be done. Homework 1 due 11:59 pm next Wednesday, January 14 Review math essential

More information

AP Computer Science AB Syllabus 1

AP Computer Science AB Syllabus 1 AP Computer Science AB Syllabus 1 Course Resources Java Software Solutions for AP Computer Science, J. Lewis, W. Loftus, and C. Cocking, First Edition, 2004, Prentice Hall. Video: Sorting Out Sorting,

More information

Data Structure [Question Bank]

Data Structure [Question Bank] Unit I (Analysis of Algorithms) 1. What are algorithms and how they are useful? 2. Describe the factor on best algorithms depends on? 3. Differentiate: Correct & Incorrect Algorithms? 4. Write short note:

More information

02-201: Programming for Scientists

02-201: Programming for Scientists 1. Course Information 1.1 Course description 02-201: Programming for Scientists Carl Kingsford Fall 2015 Provides a practical introduction to programming for students with little or no prior programming

More information

Orbital Mechanics. Angular Momentum

Orbital Mechanics. Angular Momentum Orbital Mechanics The objects that orbit earth have only a few forces acting on them, the largest being the gravitational pull from the earth. The trajectories that satellites or rockets follow are largely

More information

Programming Using Python

Programming Using Python Introduction to Computation and Programming Using Python Revised and Expanded Edition John V. Guttag The MIT Press Cambridge, Massachusetts London, England CONTENTS PREFACE xiii ACKNOWLEDGMENTS xv 1 GETTING

More information

A Note for Students: How to Use This Book

A Note for Students: How to Use This Book Preface This book is an introduction to computer science. It is intended for beginning CS majors or students from other fields who want a general introduction to computer science and computer programming.

More information

Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1.

Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology Professors Erik Demaine and Shafi Goldwasser Quiz 1. Introduction to Algorithms March 10, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Erik Demaine and Shafi Goldwasser Quiz 1 Quiz 1 Do not open this quiz booklet until you are directed

More information

Some programming experience in a high-level structured programming language is recommended.

Some programming experience in a high-level structured programming language is recommended. Python Programming Course Description This course is an introduction to the Python programming language. Programming techniques covered by this course include modularity, abstraction, top-down design,

More information

CS Matters in Maryland CS Principles Course

CS Matters in Maryland CS Principles Course CS Matters in Maryland CS Principles Course Curriculum Overview Project Goals Computer Science (CS) Matters in Maryland is an NSF supported effort to increase the availability and quality of high school

More information

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

1.00 Lecture 1. Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders 1.00 Lecture 1 Course Overview Introduction to Java Reading for next time: Big Java: 1.1-1.7 Course information Course staff (TA, instructor names on syllabus/faq): 2 instructors, 4 TAs, 2 Lab TAs, graders

More information

Using Web-based Tools to Enhance Student Learning and Practice in Data Structures Course

Using Web-based Tools to Enhance Student Learning and Practice in Data Structures Course Using Web-based Tools to Enhance Student Learning and Practice in Data Structures Course 1. Introduction Chao Chen January 2014 The purpose of this project is to enhance student learning and practice in

More information

Bachelor of Games and Virtual Worlds (Programming) Subject and Course Summaries

Bachelor of Games and Virtual Worlds (Programming) Subject and Course Summaries First Semester Development 1A On completion of this subject students will be able to apply basic programming and problem solving skills in a 3 rd generation object-oriented programming language (such as

More information

Lecture 13. Gravity in the Solar System

Lecture 13. Gravity in the Solar System Lecture 13 Gravity in the Solar System Guiding Questions 1. How was the heliocentric model established? What are monumental steps in the history of the heliocentric model? 2. How do Kepler s three laws

More information

Asking Hard Graph Questions. Paul Burkhardt. February 3, 2014

Asking Hard Graph Questions. Paul Burkhardt. February 3, 2014 Beyond Watson: Predictive Analytics and Big Data U.S. National Security Agency Research Directorate - R6 Technical Report February 3, 2014 300 years before Watson there was Euler! The first (Jeopardy!)

More information

Describe the process of parallelization as it relates to problem solving.

Describe the process of parallelization as it relates to problem solving. Level 2 (recommended for grades 6 9) Computer Science and Community Middle school/junior high school students begin using computational thinking as a problem-solving tool. They begin to appreciate the

More information

Sorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2)

Sorting revisited. Build the binary search tree: O(n^2) Traverse the binary tree: O(n) Total: O(n^2) + O(n) = O(n^2) Sorting revisited How did we use a binary search tree to sort an array of elements? Tree Sort Algorithm Given: An array of elements to sort 1. Build a binary search tree out of the elements 2. Traverse

More information

Partitioning and Divide and Conquer Strategies

Partitioning and Divide and Conquer Strategies and Divide and Conquer Strategies Lecture 4 and Strategies Strategies Data partitioning aka domain decomposition Functional decomposition Lecture 4 and Strategies Quiz 4.1 For nuclear reactor simulation,

More information

NP-Completeness I. Lecture 19. 19.1 Overview. 19.2 Introduction: Reduction and Expressiveness

NP-Completeness I. Lecture 19. 19.1 Overview. 19.2 Introduction: Reduction and Expressiveness Lecture 19 NP-Completeness I 19.1 Overview In the past few lectures we have looked at increasingly more expressive problems that we were able to solve using efficient algorithms. In this lecture we introduce

More information

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits Outline NP-completeness Examples of Easy vs. Hard problems Euler circuit vs. Hamiltonian circuit Shortest Path vs. Longest Path 2-pairs sum vs. general Subset Sum Reducing one problem to another Clique

More information

Faster deterministic integer factorisation

Faster deterministic integer factorisation David Harvey (joint work with Edgar Costa, NYU) University of New South Wales 25th October 2011 The obvious mathematical breakthrough would be the development of an easy way to factor large prime numbers

More information

Approximation Algorithms

Approximation Algorithms Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

More information

Data Structures and Algorithms Written Examination

Data Structures and Algorithms Written Examination Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where

More information

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite

ALGEBRA. sequence, term, nth term, consecutive, rule, relationship, generate, predict, continue increase, decrease finite, infinite ALGEBRA Pupils should be taught to: Generate and describe sequences As outcomes, Year 7 pupils should, for example: Use, read and write, spelling correctly: sequence, term, nth term, consecutive, rule,

More information

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 17 Shannon-Fano-Elias Coding and Introduction to Arithmetic Coding

More information

CS5310 Algorithms 3 credit hours 2 hours lecture and 2 hours recitation every week

CS5310 Algorithms 3 credit hours 2 hours lecture and 2 hours recitation every week CS5310 Algorithms 3 credit hours 2 hours lecture and 2 hours recitation every week This course is a continuation of the study of data structures and algorithms, emphasizing methods useful in practice.

More information

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm.

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. !-approximation algorithm. Approximation Algorithms Chapter Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of

More information

Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar

Complexity Theory. IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar Complexity Theory IE 661: Scheduling Theory Fall 2003 Satyaki Ghosh Dastidar Outline Goals Computation of Problems Concepts and Definitions Complexity Classes and Problems Polynomial Time Reductions Examples

More information

A Working Knowledge of Computational Complexity for an Optimizer

A Working Knowledge of Computational Complexity for an Optimizer A Working Knowledge of Computational Complexity for an Optimizer ORF 363/COS 323 Instructor: Amir Ali Ahmadi TAs: Y. Chen, G. Hall, J. Ye Fall 2014 1 Why computational complexity? What is computational

More information

Discrete Optimization

Discrete Optimization Discrete Optimization [Chen, Batson, Dang: Applied integer Programming] Chapter 3 and 4.1-4.3 by Johan Högdahl and Victoria Svedberg Seminar 2, 2015-03-31 Todays presentation Chapter 3 Transforms using

More information

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li Computer Algorithms NP-Complete Problems NP-completeness The quest for efficient algorithms is about finding clever ways to bypass the process of exhaustive search, using clues from the input in order

More information

Machine Learning. CUNY Graduate Center, Spring 2013. Professor Liang Huang. huang@cs.qc.cuny.edu

Machine Learning. CUNY Graduate Center, Spring 2013. Professor Liang Huang. huang@cs.qc.cuny.edu Machine Learning CUNY Graduate Center, Spring 2013 Professor Liang Huang huang@cs.qc.cuny.edu http://acl.cs.qc.edu/~lhuang/teaching/machine-learning Logistics Lectures M 9:30-11:30 am Room 4419 Personnel

More information

Basic Programming and PC Skills: Basic Programming and PC Skills:

Basic Programming and PC Skills: Basic Programming and PC Skills: Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of

More information

Precalculus Orientation and FAQ

Precalculus Orientation and FAQ Precalculus Orientation and FAQ MATH 1011 (Precalculus) is a four hour 3 credit course that prepares a student for Calculus. Topics covered include linear, quadratic, polynomial, rational, exponential,

More information

YOU CAN COUNT ON NUMBER LINES

YOU CAN COUNT ON NUMBER LINES Key Idea 2 Number and Numeration: Students use number sense and numeration to develop an understanding of multiple uses of numbers in the real world, the use of numbers to communicate mathematically, and

More information

Algebraic Computation Models. Algebraic Computation Models

Algebraic Computation Models. Algebraic Computation Models Algebraic Computation Models Ζυγομήτρος Ευάγγελος ΜΠΛΑ 201118 Φεβρουάριος, 2013 Reasons for using algebraic models of computation The Turing machine model captures computations on bits. Many algorithms

More information

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new Reminder: Complexity (1) Parallel Complexity Theory Lecture 6 Number of steps or memory units required to compute some result In terms of input size Using a single processor O(1) says that regardless of

More information

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new GAP (2) Graph Accessibility Problem (GAP) (1)

Reminder: Complexity (1) Parallel Complexity Theory. Reminder: Complexity (2) Complexity-new GAP (2) Graph Accessibility Problem (GAP) (1) Reminder: Complexity (1) Parallel Complexity Theory Lecture 6 Number of steps or memory units required to compute some result In terms of input size Using a single processor O(1) says that regardless of

More information

(Refer Slide Time: 2:03)

(Refer Slide Time: 2:03) Control Engineering Prof. Madan Gopal Department of Electrical Engineering Indian Institute of Technology, Delhi Lecture - 11 Models of Industrial Control Devices and Systems (Contd.) Last time we were

More information

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ Answer the following 1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++ 2) Which data structure is needed to convert infix notations to postfix notations? Stack 3) The

More information

Chapter 11. 11.1 Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling

Chapter 11. 11.1 Load Balancing. Approximation Algorithms. Load Balancing. Load Balancing on 2 Machines. Load Balancing: Greedy Scheduling Approximation Algorithms Chapter Approximation Algorithms Q. Suppose I need to solve an NP-hard problem. What should I do? A. Theory says you're unlikely to find a poly-time algorithm. Must sacrifice one

More information

How To Run Statistical Tests in Excel

How To Run Statistical Tests in Excel How To Run Statistical Tests in Excel Microsoft Excel is your best tool for storing and manipulating data, calculating basic descriptive statistics such as means and standard deviations, and conducting

More information

CS 2302 Data Structures Spring 2015

CS 2302 Data Structures Spring 2015 1. General Information Instructor: CS 2302 Data Structures Spring 2015 Olac Fuentes Email: ofuentes@utep.edu Web: www.cs.utep.edu/ofuentes Office hours: Tuesdays and Thursdays 2:00-3:30, or by appointment,

More information

Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction

Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction Lecture 11 Dynamic Programming 11.1 Overview Dynamic Programming is a powerful technique that allows one to solve many different types of problems in time O(n 2 ) or O(n 3 ) for which a naive approach

More information

Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally

Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally Recurrence Relations Many algorithms, particularly divide and conquer algorithms, have time complexities which are naturally modeled by recurrence relations. A recurrence relation is an equation which

More information

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313]

CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313] CPSC 211 Data Structures & Implementations (c) Texas A&M University [ 313] File Structures A file is a collection of data stored on mass storage (e.g., disk or tape) Why on mass storage? too big to fit

More information

Overview. Essential Questions. Precalculus, Quarter 4, Unit 4.5 Build Arithmetic and Geometric Sequences and Series

Overview. Essential Questions. Precalculus, Quarter 4, Unit 4.5 Build Arithmetic and Geometric Sequences and Series Sequences and Series Overview Number of instruction days: 4 6 (1 day = 53 minutes) Content to Be Learned Write arithmetic and geometric sequences both recursively and with an explicit formula, use them

More information

Polynomial Degree and Finite Differences

Polynomial Degree and Finite Differences CONDENSED LESSON 7.1 Polynomial Degree and Finite Differences In this lesson you will learn the terminology associated with polynomials use the finite differences method to determine the degree of a polynomial

More information

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm. Approximation Algorithms 11 Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of three

More information

CS/COE 1501 http://cs.pitt.edu/~bill/1501/

CS/COE 1501 http://cs.pitt.edu/~bill/1501/ CS/COE 1501 http://cs.pitt.edu/~bill/1501/ Lecture 01 Course Introduction Meta-notes These notes are intended for use by students in CS1501 at the University of Pittsburgh. They are provided free of charge

More information

Algebra 1 Course Information

Algebra 1 Course Information Course Information Course Description: Students will study patterns, relations, and functions, and focus on the use of mathematical models to understand and analyze quantitative relationships. Through

More information

Master Degree Program in Computer Science (CS)

Master Degree Program in Computer Science (CS) Master Degree Program in Computer Science (CS) Students holding Bachelor s degree in Computer Science are accepted as graduate students, after meeting the general requirements stated below. Applicants

More information

ML for the Working Programmer

ML for the Working Programmer ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming

More information

Introduction to Programming System Design. CSCI 455x (4 Units)

Introduction to Programming System Design. CSCI 455x (4 Units) Introduction to Programming System Design CSCI 455x (4 Units) Description This course covers programming in Java and C++. Topics include review of basic programming concepts such as control structures,

More information

So today we shall continue our discussion on the search engines and web crawlers. (Refer Slide Time: 01:02)

So today we shall continue our discussion on the search engines and web crawlers. (Refer Slide Time: 01:02) Internet Technology Prof. Indranil Sengupta Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur Lecture No #39 Search Engines and Web Crawler :: Part 2 So today we

More information

Section 1.1. Introduction to R n

Section 1.1. Introduction to R n The Calculus of Functions of Several Variables Section. Introduction to R n Calculus is the study of functional relationships and how related quantities change with each other. In your first exposure to

More information

Analysis of Binary Search algorithm and Selection Sort algorithm

Analysis of Binary Search algorithm and Selection Sort algorithm Analysis of Binary Search algorithm and Selection Sort algorithm In this section we shall take up two representative problems in computer science, work out the algorithms based on the best strategy to

More information

Data Storage 3.1. Foundations of Computer Science Cengage Learning

Data Storage 3.1. Foundations of Computer Science Cengage Learning 3 Data Storage 3.1 Foundations of Computer Science Cengage Learning Objectives After studying this chapter, the student should be able to: List five different data types used in a computer. Describe how

More information

Professional Organization Checklist for the Computer Science Curriculum Updates. Association of Computing Machinery Computing Curricula 2008

Professional Organization Checklist for the Computer Science Curriculum Updates. Association of Computing Machinery Computing Curricula 2008 Professional Organization Checklist for the Computer Science Curriculum Updates Association of Computing Machinery Computing Curricula 2008 The curriculum guidelines can be found in Appendix C of the report

More information

Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C

Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C Tutorial#1 Q 1:- Explain the terms data, elementary item, entity, primary key, domain, attribute and information? Also give examples in support of your answer? Q 2:- What is a Data Type? Differentiate

More information

Binary Heap Algorithms

Binary Heap Algorithms CS Data Structures and Algorithms Lecture Slides Wednesday, April 5, 2009 Glenn G. Chappell Department of Computer Science University of Alaska Fairbanks CHAPPELLG@member.ams.org 2005 2009 Glenn G. Chappell

More information

Data Structures. Algorithm Performance and Big O Analysis

Data Structures. Algorithm Performance and Big O Analysis Data Structures Algorithm Performance and Big O Analysis What s an Algorithm? a clearly specified set of instructions to be followed to solve a problem. In essence: A computer program. In detail: Defined

More information

Computer Science 217

Computer Science 217 Computer Science 217 Midterm Exam Fall 2009 October 29, 2009 Name: ID: Instructions: Neatly print your name and ID number in the spaces provided above. Pick the best answer for each multiple choice question.

More information

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics*

IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* IE 680 Special Topics in Production Systems: Networks, Routing and Logistics* Rakesh Nagi Department of Industrial Engineering University at Buffalo (SUNY) *Lecture notes from Network Flows by Ahuja, Magnanti

More information

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students

Eastern Washington University Department of Computer Science. Questionnaire for Prospective Masters in Computer Science Students Eastern Washington University Department of Computer Science Questionnaire for Prospective Masters in Computer Science Students I. Personal Information Name: Last First M.I. Mailing Address: Permanent

More information

Numerical Matrix Analysis

Numerical Matrix Analysis Numerical Matrix Analysis Lecture Notes #10 Conditioning and / Peter Blomgren, blomgren.peter@gmail.com Department of Mathematics and Statistics Dynamical Systems Group Computational Sciences Research

More information

The Model Checker SPIN

The Model Checker SPIN The Model Checker SPIN Author: Gerard J. Holzmann Presented By: Maulik Patel Outline Introduction Structure Foundation Algorithms Memory management Example/Demo SPIN-Introduction Introduction SPIN (Simple(

More information

Binary Heaps * * * * * * * / / \ / \ / \ / \ / \ * * * * * * * * * * * / / \ / \ / / \ / \ * * * * * * * * * *

Binary Heaps * * * * * * * / / \ / \ / \ / \ / \ * * * * * * * * * * * / / \ / \ / / \ / \ * * * * * * * * * * Binary Heaps A binary heap is another data structure. It implements a priority queue. Priority Queue has the following operations: isempty add (with priority) remove (highest priority) peek (at highest

More information

Back Propagation Neural Networks User Manual

Back Propagation Neural Networks User Manual Back Propagation Neural Networks User Manual Author: Lukáš Civín Library: BP_network.dll Runnable class: NeuralNetStart Document: Back Propagation Neural Networks Page 1/28 Content: 1 INTRODUCTION TO BACK-PROPAGATION

More information

CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

CS 2112 Spring 2014. 0 Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions CS 2112 Spring 2014 Assignment 3 Data Structures and Web Filtering Due: March 4, 2014 11:59 PM Implementing spam blacklists and web filters requires matching candidate domain names and URLs very rapidly

More information

(67902) Topics in Theory and Complexity Nov 2, 2006. Lecture 7

(67902) Topics in Theory and Complexity Nov 2, 2006. Lecture 7 (67902) Topics in Theory and Complexity Nov 2, 2006 Lecturer: Irit Dinur Lecture 7 Scribe: Rani Lekach 1 Lecture overview This Lecture consists of two parts In the first part we will refresh the definition

More information

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science

ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science ADVANCED SCHOOL OF SYSTEMS AND DATA STUDIES (ASSDAS) PROGRAM: CTech in Computer Science Program Schedule CTech Computer Science Credits CS101 Computer Science I 3 MATH100 Foundations of Mathematics and

More information

Algorithm Design and Analysis

Algorithm Design and Analysis Algorithm Design and Analysis LECTURE 27 Approximation Algorithms Load Balancing Weighted Vertex Cover Reminder: Fill out SRTEs online Don t forget to click submit Sofya Raskhodnikova 12/6/2011 S. Raskhodnikova;

More information

Near Optimal Solutions

Near Optimal Solutions Near Optimal Solutions Many important optimization problems are lacking efficient solutions. NP-Complete problems unlikely to have polynomial time solutions. Good heuristics important for such problems.

More information

MATHEMATICAL TOOLS FOR ECONOMICS ECON 1078-001 SPRING 2012

MATHEMATICAL TOOLS FOR ECONOMICS ECON 1078-001 SPRING 2012 MATHEMATICAL TOOLS FOR ECONOMICS ECON 1078-001 SPRING 2012 Instructor: Hakon Skjenstad Class Time: M, W, F, 12:00-12:50pm Classroom: DUAN G125 Email: hakon.skjenstad@colorado.edu Course Website: CULearn

More information

In mathematics, it is often important to get a handle on the error term of an approximation. For instance, people will write

In mathematics, it is often important to get a handle on the error term of an approximation. For instance, people will write Big O notation (with a capital letter O, not a zero), also called Landau's symbol, is a symbolism used in complexity theory, computer science, and mathematics to describe the asymptotic behavior of functions.

More information

Pre-Calculus Semester 1 Course Syllabus

Pre-Calculus Semester 1 Course Syllabus Pre-Calculus Semester 1 Course Syllabus The Plano ISD eschool Mission is to create a borderless classroom based on a positive student-teacher relationship that fosters independent, innovative critical

More information

Solutions to old Exam 1 problems

Solutions to old Exam 1 problems Solutions to old Exam 1 problems Hi students! I am putting this old version of my review for the first midterm review, place and time to be announced. Check for updates on the web site as to which sections

More information

Chapter 3.8 & 6 Solutions

Chapter 3.8 & 6 Solutions Chapter 3.8 & 6 Solutions P3.37. Prepare: We are asked to find period, speed and acceleration. Period and frequency are inverses according to Equation 3.26. To find speed we need to know the distance traveled

More information