### Interview Questions on Graphs

Route Between Nodes We’re given a directed graph and two nodes (X and Y). Design an algorithm to check whether there exists a route between the two nodes. For the

Route Between Nodes We’re given a directed graph and two nodes (X and Y). Design an algorithm to check whether there exists a route between the two nodes. For the

Minimal Tree We’re given a sorted array(ascending order) with unique integer elements. Write an algorithm to create a binary search tree with minimal height. For the implementation of the solution

A backtracking algorithm is a problem-solving algorithm that uses a brute force approach for finding the desired output. The Brute force approach tries out all the possible solutions and chooses the desired/best

Problem-solving is the process of identifying a problem, creating an algorithm to solve the given problem, and finally implementing the algorithm to develop a computer program

Dynamic Programming(DP) is an algorithmic technique for solving an optimization problem by breaking it down into simpler subproblems and utilizing the fact that the optimal solution to the overall problem depends upon the optimal solution to the subproblems

Divide and Conquer is an algorithm design paradigm that works by recursively breaking down a problem into subproblems of similar type until they become simple enough to solve directly.

A greedy algorithm is a method of solving a problem that chooses the best solution available at the time. It is not concerned about whether the current best outcome will lead to the overall best result

Kruskal’s Algorithm and Prim’s Algorithm are “minimum spanning tree” algorithms. For the implementation of these algorithms, we must have adequate knowledge of Graphs and Disjoint set data structures

A spanning tree is a subset of a Graph, which has all the vertices covered using a minimum possible number of edges. A spanning tree comprises all the vertices of a given graph. Hence, the graph under consideration must be connected.

The All Pair Shortest Path Problem is about finding a path between each and every vertex to all other vertices in a graph such that the total distance between them is minimum

Bellman-Ford’s algorithm finds the shortest path between any two nodes of a given graph. While traversing the shortest path between two nodes, it is not necessary that every node will be visited

The single-source shortest path problem is about finding the paths between a given vertex(called the source) to all the other vertices(called the destination) in a graph such that the total distance between them is minimum.

A Graph is a non-linear data structure comprising nodes and edges. The nodes of a graph are also called vertices and the lines or arcs connecting two vertices are called edges

Topological sort algorithm for Directed Acyclic Graph (DAG) is a linear arrangement of vertices such that for every directed edge x-y, vertex x comes before y in the arrangement. Topological sorting is only applicable on graphs that are

The single-source shortest path problem is about finding the paths between a given vertex(called the source) to all the other vertices(called the destination) in a graph such that the total distance between them is minimum

Searching algorithms are implemented to search for elements and retrieve their values from any data structure.

Sorting refers to arranging data in a systematic order, either in ascending or descending order. A Sorting Algorithm is used to rearrange a given array or list of elements by comparing the elements based on some operator.

Hashing is a method of indexing and sorting data. The idea behind hashing is to allow large amounts of data to be indexed using keys commonly created by formulas

A Trie is a special data structure used to store strings that can be visualized like a graph. A Trie is a tree-based data structure that organizes information in a hierarchy. It constitutes nodes and edges

A binary heap is a Binary Tree, It is a complete tree, i.e., all levels of the tree are filled except possibly the last level and the leaf nodes are as left as possible. This property of Binary Heap makes them more suitable to be stored in ann array

A doubly linked list is a python data structure wherein the data elements are stored as nodes. In a doubly linked list, each node of the list has two references, one of the previous node and the other of the next node.

A circular singly linked list is a python data structure wherein the data elements are stored as nodes. Each node contains two variables. One of them is the data value that the node stores and the other is the address link to the next node in the linked list.

A circular singly linked list is similar to a singly linked list. The only difference is that the last node holds a reference to the first node of the linked list

A circular doubly linked list is a python data structure wherein data elements are stored as nodes. Circular doubly linked lists are similar to doubly linked lists. The only difference is that their first and last nodes are interconnected as well

A tree is a non-linear data structure that has hierarchical relationships between its elements. It consists of nodes, connected by edges, that store data item. The arrangement of elements is such that the formation of a cycle is avoided

A Binary Search Tree is a Binary Tree data structure in which nodes are arranged in a specific order. A binary search tree satisfies the following properties

An AVL Tree is a self-balancing Binary Search Tree (BST) where the difference between the heights of left and right subtrees of any node cannot be more than one. While performing operations, if at any time they differ by more than one, rebalancing is performed to restore this property

In python, the queue is an abstract data structure that stores elements linearly. The items in a queue follow the First-In/First-Out (FIFO) order. This means that the first element to be inserted in a queue will be the first one to be removed

In python, the stack is an abstract data structure that stores elements linearly. The items in a stack follow the Last-In/First-Out (LIFO) order. This means that the last element to be inserted in a stack will be the first one to be removed

A tuple is an immutable sequence of Python objects. Similar to lists, tuples are sequential arrangements of data items. However, the elements of a tuple cannot be changed once assigned

A linked list is a sequential collection of data elements, which are connected together via links. A linked list consists of independent nodes containing any type of data and each node holds a reference or a link to the next node in the list