Category Archives: DSA

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

Java Program for Tower of Hanoi Problem

Source of Tower of Hanoi has been after Tower of Brahma custom. Story begins like this, in an antiquated sanctuary of Kashi which contains a huge room with three towers in it encompassed by 64 golden disks. At the time of formation of the world, Brahma made a precious stone tower with 64 discs made… Read More »

Counting Sort in C

Here you will learn about counting sort in C   Counting sort algorithm is a sorting algorithm which do not involve comparison between elements of an array. In this tutorial I am sharing counting sort program in C. Steps that I am doing to sort the elements are given below. 1. First of all I… Read More »

Binary Search Tree in C

Here you will get program for binary search tree in C.   A Binary Search Tree (BST) is a binary tree in which all the elements stored in the left subtree of node x are less then x and all elements stored in the right subtree of node x are greater then x. Below I… Read More »

Category: DSA