Skip to content

samadeep/Data-Structures-CPP-Codes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

Data Structure Course Codes

This repository contains the codes of the Data Structures CS-202 course at National Institute of Technology , Hamirpur during Even-Semester of 2023 . The course covered a wide range of data structures, including linked lists, stacks, queues, trees, and graphs. The codes in this repository are written in C++ and are accompanied by unit tests along with pdf of the Lab Report for in Latex for reference.

I hope that this repository will be helpful to other students who are taking the Data Structure course or who are interested in learning more about data structures.

Data Structures

The following **Data Structures and Algorithms** are covered in this repository:
 - Arrays
 - Linked Lists
 - Stacks
 - Queues
 - Trees
 - Graphs
 - Searching Algorithms : Linear and Binary
 - Sorting Algorithms :  Quick Sort, Merge Sort, Insertion Sort and Selection Sort
 - Binary Search Trees
 - Time Complexity Analysis
 - Max Priority queue using Max Heap

Contributing : I welcome contributions to this repository. If you find any errors in the codes or if you have any suggestions for improvements, please feel free to open an issue or a pull request.

Questions :

0. Write a Program to create an array of n integers.

Then we need to reassign the values of average of the sum of the elements so
far and replace the original value of the element

Solution 1: Use two loops to calculate the value of the sum variable then assign each time.

Solution 2: Use a single loop to update the value of the sum variable

Then plot the graph for both the operations to find the exponential growth.
Example Output

Input Array:       1  2   3   4    5
Array Output is    1 3/2 6/3 10/4 15/5 i.e average of the elements so far.

Array Output       1  1.5  2  2.5  3
1. Write a program to sort an array (make a dynamic array) using Bubble sort. Use 1-bit variable
FLAG to signal when no interchange take place during pass. If FLAG is 0 after any pass, then list
is already sorted and there is no need to continue.
2. Write a program to search an ITEM (integer) in an array using binary search, if FOUND then delete 
that item from array and if NOT FOUND than insert that item in kth position (Input “k” from user).
3. Write a program to enter records of Five students, which should contain fields like roll No., 
name, CGPI, semester. 
- (a) List all record of all students having CGPI greater than k. 
- (b) Insert a new record of student at kth position and print the final record.
4. Implement linked list and insert and delete an element into the list.
5. Evaluate a postfix algebraic expression with the help of stack.
6. Implement a queue using arrays and linked list.
7. Implement a binary tree and implement any traversal technique as you like.
8. Implement a binary Search Tree and insert and delete a node in the BST.
9. Implement Max Priority queue using Max Heap.
10. Implement a graph and find transpose of a graph where Transpose of a directed graph G is another directed graph on the same set of vertices with all of the edges reversed compared to the orientation of the corresponding edges in G. That is, if G contains an edge (u, v) then the converse/transpose/reverse of G contains an edge (v, u) and vice versa. Implement it with the help of adjacency list and adjacency matrix.
11. Implement Quick Sort, Merge Sort, Insertion Sort and Selection Sort.

Releases

No releases published

Packages

No packages published