Algorithms Swap Nodes in Pairs In this article, we have explained an efficient approach to Swap adjacent nodes in a Singly Linked List inplace. We have presented both Iterative and Recursive implementation.
Data Structures All O`one Data Structure In this post, we will design a Data Structure that returns the string occurring maximum and minimum times in constant time O(1). This will use a hashmap and a doubly linked list utilizing the advantages of each to solve the problem.
Algorithms Substring with Concatenation of All Words In this article, we have explained two approaches to solve the problem Substring with Concatenation of All Words. This involves the idea of Hash Map and Two Pointer.
Time Complexity Time & Space Complexity of Heap Sort In this article, we have explained Time & Space Complexity of Heap Sort with detailed analysis of different cases like Worst case, Best case and Average Case.
Algorithms Rotate Image: matrix of size NxN by 90 degrees (clockwise) In this article, we have explored an efficient way to Rotate Image: matrix of size NxN by 90 degrees (clockwise) inplace by using a property of XOR operation.
Algorithms Reverse part of Singly Linked List In this post, we have demonstrated ways in which we can not only reverse a singly linked list but also some part of Singly Linked List. It takes linear time O(N) to Reverse part of Singly Linked List.
Algorithms Remove N-th Node from end of Singly Linked List In this article, we have explained two approaches to Remove N-th Node from end of Singly Linked List. We can do this in single pass / one traversal in O(N) time.
List of Interview Questions Interview Questions on Quick Sort In this article, we have presented Interview Questions on Quick Sort (MCQ) with detailed answers. You must practice this as Quick Sort is the most important topic for Coding Interviews.
Algorithms Letter Combinations of a Phone Number In this article, we have discussed two approaches (recursive + iterative) to solve the problem "Letter Combinations of a Phone Number" in C++ language with explanation of Time and Space complexity.
Algorithms Roman to Integer In this article, we have explained two efficient approaches / algorithms to convert Roman number to Integer. We have presented the implementation as well.
Algorithms Merge Intervals problem In this article, we will learn how to solve the Merge Overlapping Intervals problem in most efficient and easy to understand method with the help of stack. We do this in linear time O(N).
Algorithms Number of Islands in MxN matrix (of 0 and 1) In this article, we have explored an insightful approach/ algorithm to find the number of islands in MxN matrix. An extension of this algorithm is used by online battleship game engine.
Algorithms Flood Fill Algorithms Flood Fill algorithm is an Algorithm that determines the area connected to a given node in a N-dimensional array. Some operations are performed on the connected nodes like color change. This is also known as Seed Fill Algorithm.
Algorithms Merge K sorted Linked Lists We have explained 3 different algorithms to Merge K sorted Linked Lists such that the final Linked List is also sorted.
Algorithms K-th permutation of first N integers In this article, we will understand and explore about the concept of generating k-th lexicographical permutation of first N integers. There are O(N!) permutations but you can find it in O(N) time.
Algorithms 2 Sum Closest: Find 2 elements with sum closest to target We have explained how to solve the 2 Sum Closest problem that is Find 2 elements with sum closest to a target efficiently. We have explained 3 different approaches which involves the use of Binary Search and Two Pointer technique.
Algorithms Recovering a Binary Search Tree that has two nodes swapped In this article, we will be developing and implementing an algorithm that recovers a Binary Search Tree (BST) that had two of its nodes swapped accidentally.
Algorithms ZigZag Conversion of String with N rows In this article, we have solved the problem of ZigZag Conversion of String with N rows. We take a string and a number N (rows) as input and distribute the string in ZigZag fashion among N rows and print the final string.
Algorithms Karger’s algorithm to find Minimum Cut In this article, we will explore how the Karger's algorithm works to find the minimum cut in a graph and its C++ implementation. This is a randomized algorithm based on Graphs.
Algorithms Maximum points on a line In this article, we have explored an insightful approach/ algorithm to find the maximum number of points on a straight line. This problem finds many uses in computational geometry.
Algorithms Merge two sorted linked lists In this article, we will learn how to Merge two sorted linked list such that the final linked list is also sorted in linear time O(N).
Data Structures Scapegoat tree In this article, we will explore in detail about Scapegoat tree which is a Self Balancing Binary Tree without requiring any extra space which puts Scapegoat Tree at an unique advantage.
Algorithms Longest Common Prefix In this article, we are going to explore different approaches to find the longest common prefix between two strings. Same techniques can be applied to find the Longest Common Prefix for multiple strings.
Algorithms 4 Sum problem In this article, we have explored an insightful approach/ algorithm to find the 4 elements in an array whose sum is equal to the required answer (4 Sum problem). This concept finds many uses in computational geometry.
Algorithms Implement K stacks in one array In this article, we have present two approaches to design K stacks in one array. The challenge is to efficiently store the elements to use all available space in the array and maintain the time complexity of stack operations.