×
Home Discussions Write at Opengenus IQ
×

Search anything:

  • DSA Cheatsheet
  • HOME
  • Jobs
  • About
  • One Liner
  • RANDOM
  • Track your progress
  • Deep Learning (FREE)
  • Join our Internship 🎓
  • AI Engineering
  • Scholarship
  • Campus Ambassador

OpenGenus IQ, an open-source Computer Science Publication House, is driven by 2500+ BSc/MSc/PhD holders globally, exploring Algorithms, Deep Learning, System Design, and more since 2017.

Algorithms

Greedy approach to find a single maximal clique in O(V^2) time complexity

There can be more than one single maximal clique in a non-complete graph (since complete graph is a maximal clique itself). To find a single maximal clique in a graph we use a straightforward greedy algorithm in O(V^2) time complexity

Sadanand Vishwas Sadanand Vishwas
Algorithms

Johnson Algorithm to find the shortest paths between all pair of vertices

Johnson Algorithm is used to find shortest paths between every pair of vertices in a given weighted directed graph and here weights may be negative. Johnson Algorithm uses both Dijkstra and Bellman-Ford algorithms as subroutines.

Nisarg Shah Nisarg Shah
Algorithms

Divide numbers from 1 to n into two groups with minimum sum difference from O(2^N) to O(N)

For numbers from 1 to given n, we have to find the division of the elements into two groups having minimum absolute sum difference. We will explore two techniques Brute force which will take O(2^N) time complexity and Greedy algorithm which will take O(N) time complexity

Arvind Tatiparti
Algorithms

Using Bron Kerbosch algorithm to find maximal cliques in O(3^(N/3))

Bron–Kerbosch algorithm is an enumeration algorithm for finding maximal cliques in an undirected graph. Any n-vertex graph has at most 3^n⁄3 maximal cliques, and the worst-case running time of the Bron–Kerbosch algorithm (with a pivot strategy) is O(3^n⁄3).

Sadanand Vishwas Sadanand Vishwas
Algorithms

Centroid Decomposition of Tree

Centroid Decomposition is a divide and conquer technique which is used on trees. Given a tree with N nodes, a centroid is a node whose removal splits the given tree into a forest of trees, where each of the resulting tree contains no more than N/2 nodes.

Sadanand Vishwas Sadanand Vishwas
Algorithms

Clique in Graphs

A clique is a subset of vertices of an undirected graph G such that every two distinct vertices in the clique are adjacent; that is, its induced subgraph is complete. Cliques are one of the basic concepts of graph theory and are used in many other mathematical problems and constructions on graphs.

Sadanand Vishwas Sadanand Vishwas
Algorithms

Solving Vertex Cover Problem from O(2^n) to O(n^2)

Vertex Cover Problem is a known NP Complete problem. We will see Naive approach and Dynamic programming approach to solve the vertex cover problem for a binary tree graph and reduce the complexity from O(2^n) to O(n^2).

Sadanand Vishwas Sadanand Vishwas
Machine Learning (ML)

Understand Learning Rate by a Child's interaction with Dogs

Learning rate (Îť) is one such hyperparameter that defines the adjustment in the weights of our network with respect to the loss gradient descent. It determines how fast or slow we will move towards the optimal weights

Aditya Rakhecha Aditya Rakhecha
Data Structures

Max Heap and Min Heap

A min heap is a heap where every single parent node, including the root, is less than or equal to the value of its children nodes. The most important property of a min heap is that the node with the smallest, or minimum value, will always be the root node. Max heap is similar

Rupali Kavale Rupali Kavale
Software Engineering

How to handle Exceptions in Python?

We should handle the exception and prevent the program from crashing and this is supported in Python. We will learn about try except block, the optional else block and Finally block which makes sure a code section runs irrespective of exceptions.

Sonal Agrawal Sonal Agrawal
Software Engineering

For Loop in Python

We are going to discuss about the for loop in Python and answer the following questions: Can a For loop print the elements of a List and Tuple? Can a For Loop be used for a String? Can for loops be nested? How to use Range function in For loop? How are Continue and Break Statements used in For Loop?

Tanmayi Patibandla Tanmayi Patibandla
Software Engineering

Yield in Python

The yield statement suspends function’s execution and sends a value back to caller, but retains enough state to enable function to resume where it is left off. What are generators? What is yield? Difference between return and yield Where is yield used?

Gautam Aggrawal Gautam Aggrawal
Software Engineering

Switch Case in Java

A switch statement in Java allows an expression to be tested for equality against a list of values. Java SE 7 and later, the support for a String object is also available with switch case. We explore the basics of it like break, default statements and syntax rules

Yash Kumar Yash Kumar
Software Engineering

Explaining Classes in Python by designing a Dog

Classes are the building blocks of object oriented programming and since python is an object oriented language it supports classes implicitly. Classes give us a way to model real world objects. They combine data and functions into one entity.

Sonal Agrawal Sonal Agrawal
Machine Learning (ML)

Using ID3 Algorithm to build a Decision Tree to predict the weather

ID3 algorithm, stands for Iterative Dichotomiser 3, is a classification algorithm that follows a greedy approach of building a decision tree by selecting a best attribute that yields maximum Information Gain (IG) or minimum Entropy (H). We will use it to predict the weather and take a decision

Nidhi Mantri Nidhi Mantri
Software Engineering

Working with Strings in Java

In Java, strings are treated as objects of class String. Strings are immutable objects which means they are constant and cannot be changed once it has been created. How to create a string in Java? Does String class has a Constructor? How to compare Strings in Java? How to search a string in Java?

Rupali Kavale Rupali Kavale
Software Engineering

Introduction to Canvas

The canvas element is part of HTML5 specification and allows for rendering of 2D shapes and bitmap images. It is a low level, procedural model that updates a bitmap. Canvas also helps in making 2D games, animations, scenes or any graphics in general using JavaScript.

Neeraj Durgapal Neeraj Durgapal
Software Engineering

Representing Strings in C

Compared to other languages, C is a low-level language. It does not have any specific data-type specific for a String. Since there is no built-in data-type in C language for String, it is handled using an array of characters. A String in C can be defined as an array of characters.

Sagar
Software Engineering

Concurrency in C++

Concurrency is having multiple threads of execution for a given process. As of today, C++ does not directly support it. However, several libraries exist that will tie a given function to a new thread of execution. We look into threads, race condition, mutex, atomicity, asynchronous tasks

vineet
Algorithms

Understanding pairing nodes in Graphs (Maximum Matching)

A maximal matching is a matching M of a graph G with the property that if any edge not in M is added to M, it is no longer a matching, that is, M is maximal if it is not a subset of any other matching in graph G. We cover Blossom, Hungarian and Hopcroft Karp algorithm

Sadanand Vishwas Sadanand Vishwas
Algorithms

Blossom Maximum Matching Algorithm

The blossom algorithm, sometimes called the Edmonds' matching algorithm, can be used on any graph to construct a maximum matching. The blossom algorithm improves upon the Hungarian algorithm by shrinking cycles in the graph to reveal augmenting paths. The blossom algorithm will work on any graph.

Sadanand Vishwas Sadanand Vishwas
Algorithms

Hungarian Maximum Matching Algorithm

The Hungarian maximum matching algorithm, also called the Kuhn-Munkres algorithm, is a O(V3) algorithm that can be used to find maximum-weight matchings in bipartite graphs, which is sometimes called the assignment problem. A bipartite graph can easily be represented by an adjacency matrix

Sadanand Vishwas Sadanand Vishwas
Algorithms

Hopcroft Karp algorithm

The Hopcroft–Karp algorithm is an algorithm that takes as input a bipartite graph and produces as output a maximum cardinality matching, it runs in O(E√V) time in worst case.

Sadanand Vishwas Sadanand Vishwas
Software Engineering

if else in Kotlin

if else is a conditional control flow statement which is commonly used and is supported by all major OOP languages. We explore if else in Kotlin in this article

Thura Htue Ko Ko
Algorithms

Pigeonhole Sort

Pigeonhole sorting is a sorting algorithm that is suitable for sorting lists of elements where the number of elements and the number of possible key values are approximately the same.

Harshita Sahai Harshita Sahai
OpenGenus IQ © 2026 All rights reserved ™ [email: team@opengenus.org]
Top Posts LinkedIn Twitter