1 / 21

Lecture 15

Lecture 15. CSE 331 Oct 3, 2011. Mid term. Next Monday in class. Unfortunately I won’t be there. Jiun-Jie with my PhD students Steve & Swapnoneel will proctor the exam. Feedback Response-I. I’ll use the microphone today. Let me know via poll on the blog if it worked better.

trina
Download Presentation

Lecture 15

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 15 CSE 331 Oct 3, 2011

  2. Mid term Next Monday in class Unfortunately I won’t be there Jiun-Jie with my PhD students Steve & Swapnoneel will proctor the exam

  3. Feedback Response-I I’ll use the microphone today Let me know via poll on the blog if it worked better

  4. Feedback Response-II Problem Statement Real world problem Graphs will help us here Problem Definition Precise mathematical def Algorithm “Implementation” Data Structures Analysis Correctness/Run time

  5. Feedback Response-III The workload is “insane” and I might be unaware of it Syllabus states that you’re supposed to spend at least 8-12 hours outside of the lectures If you’re spending much more time than above, please come and talk to me I’m aware that ideal situations do not always exists More chances for you to “make-up” in the course

  6. Mid term entry Has been posted on the blog Don’t read too much into the content of the sample mid-term

  7. On Friday, Oct 7 hours-a-thon Atri: 2:00-3:00 (Bell 123) Jiun-Jie: 4:00-5:00 (Commons 9) Jesse: 5:00-6:00 (Bell 224)

  8. Empty Slots Coming up…

  9. Graph representations 1 0 1 0 1 0 Better for sparse graphs and traversals 0 1 0 Adjacency matrix Adjacency List O(1) O(n) [ O(nv) ] (u,v) in E? All neighbors of u? O(n) O(nu) O(n2) Space? O(m+n)

  10. 2 # edges = sum of # neighbors 2m = Σ u in V nu Rest of the graph Give 2 pennies to each edge Total # of pennies = 2m nv=3 v nu=4 u Each edges gives one penny to its end points # of pennies u receives = nu

  11. Questions?

  12. Today’s agenda Run-time analysis of BFS

  13. Breadth First Search (BFS) Build layers of vertices connected to s L0= {s} Assume L0,..,Ljhave been constructed Lj+1set of vertices not chosen yet but are connected to Lj Stop when new layer is empty Use CC[v] array Use linked lists

  14. An illustration 1 2 3 4 5 7 8 6 1 7 2 3 8 4 5 6

  15. Implementing DFS in O(m+n) time Same as BFS except stack instead of a queue

  16. A DFS run using an explicit stack 7 8 1 7 6 7 3 2 3 5 8 4 4 5 5 3 6 2 3 1

  17. Reading Assignment Sec 3.3, 3.4 and 3.5 of [KT]

  18. Directed graphs Model asymmetric relationships Precedence relationships u needs to be done before v means (u,v) edge

  19. Directed graphs Adjacency matrix is not symmetric Each vertex has two lists in Adj. list rep.

  20. Directed Acyclic Graph (DAG) No directed cycles Precedence relationships are consistent

  21. Topological Sorting of a DAG Order the vertices so that all edges go “forward”

More Related