Professional Documents
Culture Documents
http://ignoujaipur.blogspot.in/ Course Code : MCS-021 Course Title : Data and File Structures Assignment Number : MCA(2)/021/Assign/12 Question 1: Write an algorithm for multiplication of two sparse matrices using Linked Lists Solution #include<stdio.h> #include<conio.h> #include<alloc.h> #define MAX1 3 #define MAX2 3 #define MAXSIZE 20 #define TRUE 1 #define FALSE 2 struct sparse { int *sp ; int row ; int *result ; }; void initsparse ( struct sparse * ) ; void create_array ( struct sparse * ) ; int count ( struct sparse ) ;
Overview The problem of finding shortest paths in graphs is a fundamental optimization problem with many applications. The problem has several variants. Algorithms with near-optimal efficiency, either in theory or in practice, are known for some problem variants, such as the single-source problem. For other variants, significant improvement over the current state of the art may be possible.
A significant effort of the SPA project is devoted to the following variant of the shortest path problem. Given a graph, we preprocess it subject to the restriction that the space for the preprocessing results is limited (e.g., a small constant times the space used to store the graph). Then we would like to quickly answer queries on single-pair shortest paths. This is a natural variant of the problem as in many applications, such as that of computing driving directions (e.g., Google Maps, Yahoo! Maps, Bing Maps).
We developed several techniques for speeding up classical algorithms for the problem. These include landmark-based A* search, reach-based pruning, and their combinations. The resulting algorithms are very practical and can be used on servers, desktops, or portable devices (e.g., car navigation systems). Some of these algorithms are being used by Bing Maps. With Hub Labels, we have the fastest known point-to-point shortest path queries on road networks.
More recently, within our Customizable Route Planning project, we have been looking at even more flexible approaches, which allow for real-time traffic updates, blocked roads, personalized (customized) driving directions, reasonable alternative paths, and many other features. To achieve this, we use our own state-of-the-art graph partitioning algorithm, PUNCH.
Additional details about our results can be found in project publications. Related Resources Links http://goo.gl/D8AJO http://goo.gl/GND4c Question 4: What are the applications of Red-Black Trees. Solution: A red-black tree is a particular implementation of a self-balancing binary search tree, and today it seems to be the most popular choice of implementation.
Binary search trees are used to implement finite maps, where you store a set of keys with associated values. You can also implement sets by only using the keys and not storing any values.
Balancing the tree is needed to guarantee good performance, as otherwise the tree could degenerate into a list, for example if you insert keys which are already sorted.
The advantage of search trees over hash tables is that you can traverse the tree efficiently in sort order.
AVL-trees are another variant of balanced binary search trees. They where popular before red-black trees where known. They are more carefully balanced, with a maximal difference of one between the heights of the left and right subtree (RB trees guarantee at most a factor of two). Their main drawback is that rebalancing takes more effort.
So red-black trees are certainly a good but not the only choice for this application.
Note: We are not the Copyright Owner of these solutions, we found some solution from the web, This Assignment is