Category Archives: 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

Doubly Linked List in C and C++

In this tutorial you will learn about doubly linked list in C and C++. In singly linked list, we can move/traverse only in one single direction because each node has the address of the next node only. Suppose we are in the middle of the linked list and we want the address of previous node… Read More »

Category: DSA

Breadth First Search (BFS) Program in C

In this tutorial we will discuss about Breadth First Search or BFS program in C with algorithm and an example. Before jumping to actual coding lets discuss something about Graph and BFS. Also Read: Depth First Search (DFS) Traversal of a Graph [Algorithm and Program] A Graph G = (V, E) is a collection of sets… Read More »

Category: DSA