Max Heap Data Structure Implementation in Java
A max heap is a complete binary tree in which the value of a node is greater than or equal to the values of its children. Max Heap data structure is useful for sorting data….
Data Structure and Algorithms are the building blocks of computer programming. A well-defined data structure helps us in keeping our data organized. Some of the commonly used data structures are List, Queue, Stack, Tree etc.
The algorithms provide different ways to achieve a task on these data structures. Some of the common algorithms are in the area of sorting and searching elements in the data structure.
A max heap is a complete binary tree in which the value of a node is greater than or equal to the values of its children. Max Heap data structure is useful for sorting data….
Heapsort is a sorting algorithm that uses Binary heaps for the purpose of sorting. Heaps can be of two types, min-heap and max heap. Heapsort is an improved version of selection sort. For this tutorial….
Maximum Subarray Problem is a famous problem in dynamic programming. The algorithm we use to solve this problem is known as Kadane’s algorithm. It is a slightly tricky algorithm to understand but don’t you worry…..
Breadth-First Search and Depth-First Search are two techniques of traversing graphs and trees. In this tutorial, we will focus mainly on BFS and DFS traversals in trees. What is Depth First Search (DFS)? The algorithm….
The Tower of Hanoi is a classic problem in the world of programming. The problem setup consists of three rods/pegs and n disks. The disks can be moved from one peg to another. The n….
In this article, we’re talking about an adjacency list. A graph is a collection of edges and vertices. It is a convenient way of representing a network of nodes. There are multiple ways to represent….
If you love playing chess, you’ll enjoy learning about the N-queens problem. It is a good problem to understand backtracking. What is Backtracking? In backtracking, we start with one possible move out of many available….
We’ll be solving Knapsack using Dynamic programming in Java and C. The knapsack problem is a commonly asked question in Technical interviews. Interviewers use this question to test the ability of a candidate in Dynamic….
In case of binary trees, if the trees are skewed, they become computationally inefficient to perform operations on. This is the motivation behind making sure that trees are not skewed. Hence the need for balanced….
A minimum spanning tree aka minimum weight spanning tree is a subset of the edges of a connected, edge-weighted undirected graph. This subset connects all the vertices together, without any cycles and with the minimum….