Data Structure and Algorithms

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.

Max Heap in Java

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….

Heapsort

HeapSort implementation in Java/C++

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….

Kadane's Algorithm

Kadane’s Algorithm to solve Maximum Subarray Problem

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 (BFS) and Depth-First Search (DFS) for Binary Trees in Java

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….

Tower of Hanoi – Algorithm and Implementation in Java

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….

ADJACENCY LIST

Adjacency List – Theory and Implementation in Java/C++

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….

N Queen Problem Using Backtracking

N-Queens problem using backtracking in Java/C++

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 pos­si­ble move out of many avail­able….

knapsack using Dynamic Programming

Solving Knapsack using Dynamic Programming (C/Java Implementation)

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….

BALANCED BINARY TREES

What is a Balanced Binary Tree and How to Check it?

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….

PRIM'S ALGORITHM

Prim’s algorithm to find a minimum spanning tree in Java

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….

close
Generic selectors
Exact matches only
Search in title
Search in content
Search in posts
Search in pages