Data Structures EECS 560
Popular in Course
Popular in Elect Engr & Computer Science
verified elite notetaker
This 15 page Class Notes was uploaded by Melissa Metz on Monday September 7, 2015. The Class Notes belongs to EECS 560 at Kansas taught by Jun Huan in Fall. Since its upload, it has received 27 views. For similar materials see /class/184023/eecs-560-kansas in Elect Engr & Computer Science at Kansas.
Reviews for Data Structures
Report this Material
What is Karma?
Karma is the currency of StudySoup.
You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!
Date Created: 09/07/15
Relax operation du the distance from the source to the node u getting updated during single source shortest path computation 11u the parent of u for trace back Wvu the edge weight from V to u if there is no edge the weight is positive in nity 5u is the shortest distance from source to the node u Relax u V If du gt dv wvu du dv wv u 11u V Bellman ford algorithm for graphs with negatively weighted edges Single source shortest path G s For each u e V du positive infinity ds 0 ForI l V For each u v e E Relaxuv Dijkstra39s Algorithms S lt 0 T lt VG initialize a priority queue While i 0 u lt extract MinQ S lt S U u for each V e Adj u relaxuvw if we use array to implement Dijkstra s algorithms Initialize V extract Min V V relax 1E Therefore OVVVEOV2 Use minheap V lgVV lgVE Therefore OVV1g V E 1g V OE 1g V using Fibonacci heap OE V 1g V All Pairs Sh01test Path Johnson39s Algorithm Johnson s algorithm contains three steps 1 For a graph G construct a new graph G with an additional node U and create directed edges from U to each and every node in G with weight 0 2 Compute the weight potential of the nodes in G where the weight The weight of a node X hX is the shortest distance from U to X 3 Update the weight of each edge W W with the following formula W uv hll39hV W uv Claims 1 ifuV ifthe shortest path is G uV ifthe shortest path is C 2 W W 2 0 Implementation Run Bellmanford algorithm VVE to obtain the potential of each node Run Dijkstra s algorithm V times to obtain all pair shortest distance Total running time V E 1g V Key de nitions A binary relation R for a set S is a set of SxS or RE SxS 1 For example SN natural numbers R is a divisor of3 is a divisor of 6 3R6 2 lt for real numbers R 3 is less than 6 3lt6 A relation is o re exive if aRa for all a e S o Symmetric if aRb ltgt bRa o Transitive if aRb and bRc gt aRc Re exive Symmetric Transitive Is a divisor of Yes No Yes lt No No Yes S Yes No Yes Assume all the undergraduate students have only one advisor sharing the same advisor is a binary relation de ned on the set of students Sharing the same advisor Re exive Yes Symmetric Yes Transitive Yes We call a re exive symmetric and transitive relation an equivalence relation If we have an equivalence relation we could partition the set into a group of subsets such that S1 U S2U SnS Si 0 Sj Si ifij for all ij 6 Ln and Q otherwise for example Susan gt Dr Wang Mike gt Dr Smith Tome gt Dr Singh John gt Dr Smith Susan Disjoint set is a data structure for equivalence relation between two operations 1 find returns a unique ID such that ndX ndy if and only if X and y belong to the same class 2 Union merges two classes For the time being lets assume that the elements are called 0123k k D N Design options Hash table or look up table Find 0 1 Union On Tree representation merge gives merge Gives Find operation returns the root of the tree find 1 ONJkJkt It Ot I union 03 01 union 13 Nothing Binomial Tree De nition 0 B0 is a single node 0 Bk is de ned recursively o Binomial tree has heaporder property 13k xquot Bo Bkl Binomial heap is a set of binomial trees with different ranks Binomial Tree Binomial Heap Yes Yes Yes Yes N0 N0 6 No Yes Q E 9 aka a a Merge Operation Rule 1 Merge two trees with different size Rule 11 Merge two trees with same size Select the one with the smallest root and attach the other one to the root as the right most child example 1 exampleZ lt3 00 Insert operation recursively apply rule I and rule II Insert 10 Insert 9 Insert 8 Insert 7 Insert 6 DeleteMin 1 Find the Min Root 2 Delete the Root 3 Merge Example Deleting the min Merging Step1 Step 2 Step 3
Are you sure you want to buy this material for
You're already Subscribed!
Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'