# Write a greedy algorithm to generate shortest path in graph

Today we will discuss one of the most important graph algorithms: Many more problems than you might at first think can be cast as shortest path problems, making this algorithm a powerful and general tool. It can also be used to solve problems like network routing, where the goal is to find the shortest path for data packets to take through a switching network. It is also used in more general search algorithms for a variety of problems ranging from automated circuit layout to speech recognition. Write a function f a,b that takes two strings and returns a string containing only the characters found in both the strings in the order of a. Explain the terms Multithreading programming and Deadlocks.

You are given a circularly sorted integers, then tell how will you find a given integer? What the difference between hashtable and hashmap? What are dangling pointer? In an array, how will you find the minimun and maximum in less number of comparisions?

What sorting algorithm would you use for a very large data set on the disk but less space in memory? You are given a string of length N and M small strings each of length L. How will you find that each of the M strings occurred in the larger string? Write the elements of a binary search tree while traversing it using the BFS algorithm.

Construct a tree with atleast 4 levels and traverse over it.

## Single-Source Shortest Path on Weighted Graphs

Write a function to combine two 2 sorted linked list, and get the new list in sorted form, without using any temporary Node.

Now write a program than can create a 1 Rs by grouping of these coins. Write a code that will remove the duplicates from a sorted array. Given an array of characters. Then reverse the order of the words in that array. The name of the stored procedure that caused an error. How do you use RSA for both authentication and secrecy?

Write a code that can find the sum of values in the left-subtree nodes after entering the root node of the tree. Give the algorithm from a preorder traversal of a binary tree represented in a 2D array. What are the various problems faced by using distributed database Systems? What is the difference between asp and asp.

Write a function to check if the two rectangles overlap or not. The structure is as follows: How is garbage collected in java? How will you find the size of a java object. Give reasons for not providing multiple inheritance in java.

Write a program that can generate the nth fibonacci number. Design a class library to writing game cards. You are given a set of pointers pointing to very large strings. Find the pointer to the lexicographically smallest and largest strings. In UNIX, how are the file blocks stored in the disk. What is disk interleaving and why is it adopted? Write a C code for 'tr' program. They both are strings of same length. Assume that deadlocks can occur only due to locks.

Now give a method that can avoid deadlocks in a system. Give the names of some routing protocols. What are digital signatures and smart cards? Write a function that can print out a 2D array in a spiral way.

You are given a sorted linked list. How will you insert an element in the list so that the sorted order retains?

Give the difference between a latch and a flip-flop. Given two numbers m,n.The earliest instances of what might today be called genetic algorithms appeared in the late s and early s, programmed on computers by evolutionary biologists who were explicitly seeking to model aspects of natural evolution.

Generic graph. This class is built on top of GraphBase, so the order of the methods in the Epydoc documentation is a little bit obscure: inherited methods come after the ones implemented directly in the subclass.

Graph provides many functions that GraphBase does not, mostly because these functions are not speed critical and they were easier to implement in Python than in pure C.

Algorithm is greedy because at each iteration of the while loop we assume that the vertex with the minimum distance has the correct distance and we locally update the distances. Cost The running time of algorithm depends on the graph, G, and priority queue, Q, implementation. o The program will generate a non-negative weighted complete graph G with the number of vertices specified interactively by the end user.

o The program will generate the distance network using repeatedDikstra(G), and measures the time taken to run the function. Given a mapping between items, and items they depend on, a topological sort orders items so that no item precedes an item it depends upon..

The compiling of a library in the VHDL language has the constraint that a library must be compiled after any library it depends on.. A . The algorithm is a Greedy Algorithm. The Greedy Choice is to pick the smallest weight edge that does not cause a cycle in the MST constructed so far.

Let us understand it with an example: Consider the below input graph.

Shortest Path Algorithm