Category Archives: DSA

Priority Queue in C and C++

Here you will get implementation of priority queue in C and C++ with program example. Priority Queue is an ordered list of homogeneous elements. In normal queue, service is provided on the basis of First-In-First-Out. In a priority queue service isn’t provided on the basis of First-In-First-Out service, but rather then each element has a… Read More »

Category: DSA

Hashing in C and C++

In this tutorial you will learn about Hashing in C and C++ with program example. You will also learn various concepts of hashing like hash table, hash function, etc. Hashing in Data Structure Searching is dominant operation on any data structure. Most of the cases for inserting, deleting, updating all operations required searching first. So… Read More »

Category: DSA

Difference between BFS and DFS

Here you will learn about difference between BFS and DFS algorithm or BFS vs. DFS. Breadth First Search (BFS) and Depth First Search (DFS) are two popular algorithms to search an element in Graph or to find whether a node can be reachable from root node in Graph or not. And these are popular traversing methods… Read More »

Category: DSA

Topological Sort in C and C++

Here you will learn and get program for topological sort in C and C++. We know many sorting algorithms used to sort the given data. It may be numeric data or strings. Take a situation that our data items have relation. They are related with some condition that one should happen only after other one… Read More »

Category: DSA

Bucket Sort in C and C++

Here you will get program for bucket sort in C and C++. In bucket sort algorithm the array elements are distributed into a number of buckets. Then each bucket sorted individually either using any other sorting algorithm or by recursively applying bucket sort. Take example shown in below image. Elements are distributed among buckets Then,… Read More »

Advantages and Disadvantages of Linked List

Here you will learn about advantages and disadvantages of linked list. It is a data structure in which elements are linked using pointers. A node represents an element in linked list which have some data and a pointer pointing to next node. Its structure looks like as shown in below image. There are various merits… Read More »

Category: DSA

Program for Quick Sort in C++

Here you will get program for quick sort in C++. Quick Sort is one of the most efficient sorting algorithm whose best, worst and average case time complexities are O (n log n), O (n2) and O (n log n) respectively.  How it works? 1. We first pick a pivot element. There are various ways… Read More »

Category: DSA

0-1 Knapsack Problem in C Using Dynamic Programming

Here you will learn about 0-1 knapsack problem in C. We are given n items with some weights and corresponding values and a knapsack of capacity W. The items should be placed in the knapsack in such a way that the total value is maximum and total weight should be less than knapsack capacity. In… Read More »

Category: DSA

Difference Between Stack and Queue

In this article you will learn about difference between stack and queue. Stack A Stack data structure works on Last In First Out principle, also abbreviated as LIFO. A Stack requires only one reference variable, known as a top pointer. Stack data structures are normally represented as a vertical representation of data items. A Stack… Read More »

Category: DSA

Applications of Stack

Here you will learn about applications of stack. Stack is an abstract data type and a data structure that follows LIFO (last in first out) strategy. It means the element added last will be removed first. Stack allows two operations push and pop. Push adds an element at the top of the stack and pop… Read More »

Category: DSA

Circular Linked List in C

Here you will get program for circular linked list in C. What is Circular Linked List? A circular linked list is a linked list in which the last node points to the head or front node making the data structure to look like a circle.  A circularly linked list node can be implemented using singly… Read More »

Category: DSA

Radix Sort Program in C

In this tutorial you will learn about radix sort program in C. Radix sorting technique is one of the oldest techniques of sorting. Lets assume that we are given a list of some names and asked to sort them alphabetically. We would normally proceed by first dividing the names into 26 different sets (since, there… Read More »

Category: DSA