# Data Structure and Algorithm

## Depth First Search in C++ – Algorithm and Source Code

Basic Theory Depth – first searches are performed by diving downward into a tree as quickly as possible. It does this by always generating a child node from the most recently expanded node, then generating that child’s children, and so on until a goal is found or some cutoff depth …

## Breadth First Search in C++ – Algorithm and Source Code

Basic Theory Breadth – first searches are performed by exploring all nodes at a given depth before proceeding to the next level. This means that all immediate children of nodes are explored before any of the children’s children are considered. It has obvious advantage of always finding a minimal path …

## Lab assignments and problems on Data Structure with CC code and Algorithm

Lab assignments and problems on Data Structure with C/C++ code and Algorithm Here are lists of lab assignments and problems on various topics in Data Structure. Please click the link below to see the algorithm and source code of the problem in that topic. Stack Queue Circular Queue Infix to …

## Implementation of Dijkstras Shortest Path Algorithm in C

Implementation of Dijkstra’s Shortest Path Algorithm in C++ Dijkstra’s Shortest Path Algorithm is popular algorithm for finding shortest path between different nodes. The algorithm (Pseudo Code) is as follows procedure Dijkstra (G): weighted connected simple graph, with all weights positive)[G has vertices a = v0, v1, ….. , vn = …

## Data Structure Hashing and Hash Table Generation using CC

Data Structure – Hashing and Hash Table Generation using C/C++ Hashing is the transformation of a string of characters into a usually shorter fixed-length value or key that represents the original string. Hash Function A function that transforms a key into a table index is called a hash function. If …

## Tree Search using C/C++

In the binary tree used to store a file, all the left descendants of a node with key key have keys that are less than key, and all the right descendants have keys that are greater than or equal to key. The inorder traversal of such a binary tree yields …

## Binary Search using CC

Binary Search using C/C++. The most efficient method of searching a sequential table without the use of auxiliary indices or tables is the binary search. Basically, the argument is compared with the key or the middle element of the table. If they are equal, the search ends successfully; otherwise, either …

## How to implement Sequential Search in CC

How to implement Sequential Search in C/C++? The simplest form of a search is  the Sequential Search. This search is applicable to a table organized either as an array or as a linked list. Let us assume that k is an array of n keys, k(0) through k(n-1), and r …

## Data Structure Implementing Tree Sort in C

Data Structure: Implementing Tree Sort in C++ In tree sort, the given data is first converted into a binary tree. The inorder traversal of the binary tree results in the sorted form which is known as tree sort. Algorithm 1. Declare and initialize necessary variables.2. Input the array of element …

## Data Structure How to implement Shell Sort in C

Data Structure: How to implement Shell Sort in C++? Shell is generalization of insertion sort and is devised by Donald Shell in 1954. The method sorts separate sub-files of original file i.e. Divide the original file into smaller sub-files. Sort individual sub-files using any sorting algorithm We choose increment ‘k’ …

## Data Structure How to implement Merge Sort in C

Data Structure: How to implement Merge Sort in C++? Merging is the process of combining two or more sorted files into a third sorted file. Merge sort is based on the divide and conquer paradigm. It can be explained as …. Let A[p…..r] is given array with indices p = …

## Data Structure How to implement Straight Insertion Sort in C

Data Structure: How to implement Straight Insertion Sort in C++? An insertion sort is that which sort a record of data by inserting records into an existing sorted file. The list is divided into two parts: sorted and unsorted. In each pass, the first element of the unsorted sub-list is …

## Data Structure How to implement Straight Insertion Sort in C

Data Structure: How to implement Straight Insertion Sort in C++? An insertion sort is that which sort a record of data by inserting records into an existing sorted file. The list is divided into two parts: sorted and unsorted. In each pass, the first element of the unsorted sub-list is …

## Data Structure How to implement Straight Selection Sort in C

Data Structure: How to implement Straight Selection Sort in C++? In selection sort, In each pass smallest/largest element is selected and placed in a sorted list. Th entire array is divided into two parts: sorted and unsorted In each pass, in the unsorted subarray, the smallest element is selected and …