## Social Network Problem

Given: There are N people in a social network and there are friends group. Each person can be part of a friend group of a specific size. Number of people in the social network...

@tutorialhorizon

Given: There are N people in a social network and there are friends group. Each person can be part of a friend group of a specific size. Number of people in the social network...

Objective: Given a graph represented by the adjacency matrix, write a Depth-First Search(DFS) algorithm to check whether the graph is bipartite or not. Bipartite Graphs OR Bigraphs is a graph whose vertices can be...

Problem Statement: When customers book an Airbnb the total price, which includes base price + service fee + cleaning fee. all these prices are in decimals. Write an algorithm to round each price such...

Objective: Given a number with N digits, write a program to get the smallest number possible after removing k digits from number N. OR Implement a method that returns the lowest possible number that...

Objective: Given a Stack, write an algorithm to reverse the stack. Example: Original Stack: [14, 9, 67, 91, 101, 25] Reversed Stack: [25, 101, 91, 67, 9, 14] Approach: Use Recursion In this solution,...

The algorithm of kMeans is an unsupervised learning algorithm for clustering a set of items into groups. Given a set of multi-dimensional items and a number of clusters, k, we are tasked of categorizing...

Objective: Design and Implement a data structure Least Recently Used (LRU) Cache. Earlier we had seen Least Recently Used (LRU) Cache – Using HashMap and Doubly Linked List. In this article, we will see...

Objective: Design and Implement a data structure Least Recently Used (LRU) Cache. Least Recently Used (LRU) Cache: You have given a cache (or memory) capacity. The cache will be filled with items you will...

Objective: Given a matrix (NxN) which represents the buildings in community. You are in a building and you need a bike to travel. There are few buildings in community which has bikes which you...

Max Flow Problem- Maximum flow problems find a feasible flow through a single-source, single-sink flow network that is maximum. This problem is useful for solving complex network flow problems such as the circulation problem. The maximum value...

Earlier we have seen what Dijkstra algorithm is is and how it works. In this article we will see its implementation using adjacency list and TreeSet. Example: Implementation – Adjacency List and Priority Queue...

Objective: Given an array of integers A[] which is sorted in two parts (both parts are individually sorted), find no of reverse pairs means no of (i, j) pairs where i belongs to the...

Earlier we have seen what Dijkstra’s algorithm is and how it works. In this article we will see its implementation using adjacency list and Priority Queue. Prerequisites: Adjacency List Priority Queue Dijkstra’s Algorithm basics...

Earlier we have seen the basics of Dijkstra algorithm. In this article we will see its implementation using adjacency list and Min Heap. We strongly recommend reading the following articles Dijkstra algorithm and how...

Earlier we have seen what Dijkstra’s algorithm is and how it works. In this article we will see its implementation using adjacency matrix. We strongly recommend reading – Dijkstra algorithm and how it works....

%d bloggers like this: