×

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

Interview Questions on Trees in Python

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

Backtracking in Python

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 in Python

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 in Python

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 Algorithm in Python

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.

Greedy Algorithms in Python

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 and Prim’s Algorithm in Python

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

Minimum Spanning Tree in Python

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.

All Pair Shortest Path Problem in Python

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 in Python

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

Dijkstra’s Algorithm in Python

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.

Graphs in Python

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 in Python

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

Single-Source Shortest Path(SSSP) Problem in Python

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 in Python

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

Sorting Algorithms in Python

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 in Python

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

Trie in Python

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

Binary Heap in Python

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

Doubly Linked Lists in Python

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.

Circular Singly Linked List in Python

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

Circular Doubly Linked List in Python

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

Tree/Binary Tree in Python

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

Binary Search Tree in Python

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

AVL Tree in Python

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

Tuples in Python

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