
Re: CS301 GDB 1 Solution and Discussion
Total Marks 5
Starting Date Monday, February 08, 2021
Closing Date Tuesday, February 09, 2021
Status Open
Question Title Graded Discussion Board
Question Description
GDB Scenario:Your friend is developing a maze puzzle game and already designed a module which can generate a random maze. The maze has one entry and one exit point. Now he needs to develop the module which will find the path from entry to exit points for randomly generated maze. Your friend wants the path searching should be quickest. He can use only Stack or Queue data structures to store maze’s visited locations for path generation. He is unable to decide the selection of data structure and asked you to help him.
GDB Question:
From Stack and Queue data structures which data structure you will suggest using for entry to exit path finding module? Select a data structure and give comments in favour to justify your selection. Also mention why you are not selecting the other data structure?
Instructions:
A concise, coherent and to the point answer is preferred over lengthy comment having irrelevant details. Answers, posted on regular Lesson’s MDB or sent through email will NOT be considered in any case.
Best of Luck!


Re: CS301 Assignment 1 Solution and Discussion
Assignment No. 01Semester Spring 2020
CS301 Data Structures
Total Marks: 20Due Date :1 June 2020
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
o The assignment is submitted after due date.
o The submitted code does NOT compile.
o The submitted assignment is other than .CPP file.
o The submitted assignment does NOT open or file is corrupted.
o The assignment is copied (from other student or ditto copy from handouts or internet).
Uploading instructions
For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file.Note: Use ONLY DevC++ IDE.
Objective
The objective of this assignment iso To make you familiar of programming with stack data structure.
For any query about the assignment, contact at [email protected]
GOOD LUCK
Marks: 20You are required to write a program in C++ to implement Stack data structure and use this data structure to store different types of books based on their identity number. You have to implement Stack data structure using array. A stack is a LIFO structure in which data elements are stored in an order such that last element pushed on the stack will be popped up first.
Your program should cover the following scenario.
Suppose a student is collecting books and throwing them into stack of books. You need to develop an application that will count different books in the stack. This stack will consist of three types of books i.e. software, hardware and other books.
You will identify book with unique numeric identity number. If book identity number will fully dividable by 8, will consider it software book. While the number fully dividable by 5 will consider it hardware book and consider rest of the books as other books.First, the program will ask the user to input size of the stack. Then the programmer will ask the user to input total number of books. Then according to the number of Books, it will ask the user to enter identity number for each book. The book identity number can be any random number between 1 and 99. If book identity number is fully dividable by 8, we will consider it software book. While the number fully dividable by 5 will consider it hardware book and consider rest of the books as other books.
Programmer should implement isFull() function of the stack to check if the number of books exceed the size of the stack and isEmpty() function to check if the stack is empty or not. Programmer should also display the message “Books not found” if no books found.
Program’s sample output is given below
Output 1:
Out Put 2:
Output 3:
Solution Guidelines:
First understand the code given in handouts about stack. Get stack size from user to allocate space for stack dynamically. Get identity number of books that user want to enter into the stack. Get value one by one and push into stack. Don’t allow popping if stack is empty and pushing if stack is full. If identity number of book is dividable by 8 and 5 then priority should be given to 8.
Lectures Covered: This assignment covers Lecture # 17.
Deadline: Your assignment must be uploaded/submitted at or before, 1 June 2020 
Re: CS301 Assignment 3 Solution and Discussion
Assignment No. 03SEMESTER FALL 2020
CS301 Data Structures Total Marks: 20
Due Date: 21/01/2021
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
o The assignment is submitted after due date.
o The submitted assignment is other than .doc/.docx file.
o The submitted assignment does NOT open or file is corrupted.
o The assignment is copied (from other student or ditto copy from handouts or internet).
Uploading instructionso For clarity and simplicity, you are required to Upload/Submit only .doc/.docx file.
Objective
The objective of this assignment is:
o Binary Search trees
o AVL trees
o Rotation cases of AVL trees
o Balancing Factor of treesFor any query about the assignment, contact at [email protected]
GOOD LUCK
Marks: 20Problem Statement:
You are required to construct AVL tree from the following data:
15 ,18 ,12, 8, 54, 5, 14, 13, 9, 61, 20, 17, 21
Solution Guidelines:
You need to insert these data items one by one starting from the data item 15 in the same order in which they have written above. Show and perform necessary rotations where needed. In Solution show only the final AVL tree and only those steps in which rotation is applied.Note: If you show only final tree and do not show the rotation steps then your marks will be deducted.
Lectures Covered: This assignment covers Lecture # 1526
Deadline: Your assignment must be uploaded/submitted at or before January 21 , 2021 
Re: CS301 Assignment 2 Solution and Discussion
Assignment No. 02Spring 2020
CS301 Data Structures
Total Marks: 20Due Date: 17Jun2020
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
The assignment is submitted after due date.
The submitted assignment is other than .CPP file.
The submitted code does NOT compile.
The submitted assignment does NOT open or file is corrupted.
The assignment is copied (from other student or ditto copy from handouts or internet).Uploading instructions
For clarity and simplicity, you are required to upload/submit only one .CPP file.Note: Use only DevC++ IDE.
Objectives
The objectives of this assignment are; To make you familiar of programming with Tree data structure
To traverse Binary Search Tree (BST) using different techniques
To perform some basic operations on BSTFor any query about the assignment, contact at [email protected]
Good Luck!
Total Marks: 20Problem Statement:
As you know, Binary Search Tree (BST) has property that on the addition of a node in the tree, we compare it with root node. If new node is less than root node, it can be added to the left subtree. Otherwise, it will be added to the right subtree. So, the BST will have numbers (or nodes) less than the root in the left subtree and the numbers greater than the root will be in the right subtree.
Following is a snapshot of Binary Search Tree (BST).
You are required to develop a C++ program implementing Binary Search Tree (BST) data structure for the above scenario.
For this you need to;
Construct Binary Search Tree, based upon above given tree data Calculate minimum node (or number), maximum node, height and total number of nodes for BST
Details:Your solution must contain a tree node class named as TNode, insert() method, buildTree() method, minNode() method, maxNode() method, treeHeight() method and countNodes() method. You should call BuildTree() method in main() method and call insert() method inside BuildTree() method so that insert() method can actually add nodes in BST.
You must call the abovementioned methods from main to calculate minimum node, maximum node, height and total number of nodes for the BST.
Remember, the height of root node is 1 while depth or level of root node is 0 in tree.
Required Output:
Note:
Make sure to follow class name, method names and variable/objects names as mentioned above in the scenario. Moreover, your solution must be according to the Required Output. Otherwise, you will get Zero marks.
Lectures Covered: Lecture No. 09 to 16.
Deadline: Your assignment must be uploaded / submitted on or before, Jun 17, 2020. 

Assignment No. 02
SEMESTER Fall 2019
CS301 Data Structures
Total Marks: 20Due Date: 29Nov, 2019
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
o The assignment is submitted after due date.
o The submitted code does NOT compile.
o The submitted assignment is other than .CPP file.
o The submitted assignment does NOT open or file is corrupted.
o The assignment is copied (from other student or ditto copy from handouts or internet).
Uploading instructions
For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file.Note: Use ONLY DevC++ IDE.
Objective
The objective of this assignment iso To make you familiar of Programming with Queue Data Structure.
For any query about the assignment, contact at [email protected]
GOOD LUCK
Marks: 20
Problem Statement:
You have to implement a Queue Data Structure for student’s admission applications in the university by using Array in C++ language. In which you have to create:
A structure (using struct keyword) named Student. A class named ArrQueue.Details:
Student structure must have two variables of type string (using string.h library) in it.
userVUID userDetail Structure Variables Description userVUID It will store the student id e.g. BC12345688 userDetail It will store user details as Name (Degree Program) e.g. Bilal (BSCS)ArrQueue should implement following data members and member functions:
Data Members Description arr[arrLength] “arr” is an array of type Student which will store queue students information in the array. While “arrLength” is the length of the array which is 5. front front variable will store the value of array index of first user in the queue. rear rear variable will store the value of array index of last user in the queue. Methods Description enQue(X) Place X after the rear of the queue (If array have empty space). e.g. queue.enQue(X). You have to handle these cases for enQue(). 1. If queue is empty. Then add Student to Queue. 2. If queue is full. Then show message: “Queue is full”. deQue() Remove the student from front position in the queue and move all students forward in the queue. (If array is not empty). e.g. queue.deQue(). You have to handle these cases for deQue(). 1. If queue is empty. Then show message at “Que is empty cannot remove students”. 2. If queue is not empty, remove element from the queue. Note: Removal of Students from Queue will be according to First In First Out (FiFO) Method (Means a student who comes to queue first will remove from the queue first then others). queLength() Return size of Queue. (Not array size) e.g. queue.queLength(). isEmpty() Return TRUE if Queue is empty, FALSE otherwise. isFull() Return TRUE if Queue is full, FALSE otherwise. showQue() Will show the Queue data as given in below screenshots (Detailed Output Screenshot). e.g. queue.showQue().(“X” denote “Student” structure Object means a student profile record while “queue” denotes and Object of the class “ArrQueue”.)
In the main() function you have to:
Create an array of objects having size 5 and of type “Student” and store five student’s data in it. Make a queue and add all students in it by using for loop with enQue() method. Then show the array using showQue() method like given in “Main Output Screenshot”. Then you have to remove students from the queue according the following conditions e.g.
Your id is “BC12345687” then last digit is 7.
a. If last digit is Even Number then remove first two students from the queue using for loop with deQue() method. There will be 3 remaining students in the queue out of 5 as we have removed two students.
For details see screenshots under “Main Output Screenshot” heading.
b. If last digit is an Odd Number (e.g. in above id 7 is an odd number) then remove first one student form the queue using for loop with deQue() method. There will be 4 remaining students in the queue out of 5 as we have removed three students.
For details see screenshots under “Main Output Screenshot” heading. After that show queue data using showQueue() method as given in “Main Output Screenshot”. Last student data should be your own data and all above ids must be one less than your id number according to Detailed Output Screenshot.Note:
If you will not follow variables, functions and class names as mentioned and explained in this file also your actual output under heading “Main Output Screenshot” is not according to “Detailed Output Screenshot” then you will get Zero marks.
Detailed Output Screenshot:Just For Your Information.
Note: Last record must be your VU ID, Name and Degree Program.
Main Output Screenshot:
For Students Id’s having Odd number in last of your id.
For Students Id’s having Even number in last of your id.
Lectures Covered: This assignment covers Lecture # 114.
Deadline: Your assignment must be uploaded/submitted at or before 29Nov, 2019. 
Assignment No. 03
Fall 2019
CS301  Data Structures
Total Marks: 20Due Date: 2112020
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
o The assignment is submitted after due date.
o The submitted assignment is other than C++ file (.cpp).
o The submitted assignment does NOT open or file is corrupted.
o The assignment is copied (from other student or ditto copy from handouts or internet).
Uploading instructions
You are required to upload / submit .CPP file.
Use DevC++, Version 5.11 or above.Objective
The objective of this assignment is ;o To make you familiar with Huffman Encoding technique.
o To learn how to write a program for Huffman Encoding in C++.For any query about the assignment, contact at [email protected]
GOOD LUCK
Problem Statement
As you know, Huffman Encoding is a technique developed and used for data compression. It is widely used algorithm for JPEG images. Incomplete code of Huffman Encoding is given below. You are required to complete the missing code.
In the given code we are using two classes and two functions. The first class HeapNode_Min will consist of data members and a constructor. The second class Analyze will consist of a function which will compare two heap nodes and will return the result. We are also using display function to print the codes of Huffman tree from the root. HCodes function is used to build a Huffman tree, this function is using two while loops and at the end it calls display_Codes function. In main function we are using two arrays, one for frequency and the second one for alphabets. We are using size_of variable to store the size of data types after their division. At the end of the main function we will call HCodes function.
Note: Just add the missing code. Don’t change the given code. Instructions are highlighted with red color.
// Huffman Coding program in c++ #include <bits/stdc++.h> using namespace std; class HeapNode_Min { // Tree node of Huffman public: //Add data members here. HeapNode_Min(char d, unsigned f) { //Complete the body of HeapNode_Min function } }; class Analyze { // two heap nodes comparison public: bool operator()(HeapNode_Min* l, HeapNode_Min* r) { (l>f > r>f); //Complete this statement } }; void display_Codes(HeapNode_Min* root, string s) // To print codes of huffman tree from the root. { if (!root) return; if (root>d != '$') cout << root>d << "\t: " << s << "\n"; display_Codes(root>l, s + "0"); display_Codes( ); //Complete this statement by passing arguments } void HCodes(char data[], int freq[], int s) // builds a Huffman Tree { HeapNode_Min *t,*r, *l ; // top, right, left priority_queue<HeapNode_Min*, vector<HeapNode_Min*>, Analyze> H_min; int a=0; while (a<s){H_min.push(new HeapNode_Min(data[a], freq[a])); ++a;} while (H_min.size() != 1) { l = H_min.top(); H_min.pop(); r = H_min.top(); H_min.pop(); t = new HeapNode_Min('$', r>f + l>f); t>r = r; t>l = l; H_min.push(t); } display_Codes(H_min.top(), ""); } int main() { int frequency[] = { 3, 6, 11, 14, 18, 25 }; char alphabet[] = { 'A', 'L', 'O', 'R', 'T', 'Y' }; int size_of = sizeof() / sizeof(); //Complete this statement by passing data type to both sizeof operators cout<<"Alphabet"<<":"<<"Huffman Code\n"; cout<<"\n"; //Call Huffman_Codes function. return 0; }Sample Output of the above program is given below.
Important Note: Use DevC++, Version 5.11 or above.
Deadline: Your assignment must be uploaded/submitted at or before 2112020. 

Assignment No. 01
Semester Fall 2019
CS301 Data Structures Total Marks: 20Due Date : 18Nov2019
Instructions
Please read the following instructions carefully before solving & submitting assignment:
It should be clear that your assignment will not get any credit (zero marks) if:
o The assignment is submitted after due date.
o The submitted code does NOT compile.
o The submitted assignment is other than .CPP file.
o The submitted assignment does NOT open or file is corrupted.
o The assignment is copied (from other student or ditto copy from handouts or internet).
Uploading instructions
For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file.Note: Use ONLY DevC++ IDE.
Objective
The objective of this assignment iso To make you familiar with implementing the Doubly Linked List data structure in C++ programming language.
For any query about the assignment, contact at [email protected]
GOOD LUCK
Marks: 20
Problem Statement:You have to implement a Double Linked List in C++ language in which you have to create a structure and two classes as given below:
A structure named as “StudentDetail” by using struct keyword.
StudentDetail structure should consist of following data members of type “string”.
name
vuidA node class named as “Node” by using class keyword.
(“X” denotes StudentDetail variable means the student details and “Y” denotes the data value of the node).
Node class will have following data members and member functions:
A doubly linked list class named as “DoublyLinkedList” by using class keyword.
DoublyLinkedList class will have following data members and member functions:
Detailed description of member functions of DoublyLinkList class:
addAtBegining(X): To add the node at the beginning of the doubly linked list class.
addAtEnd(X): To add the node at the End of the doubly linked list class.
delNode(): To delete a node pointed by current pointer in the doubly linked list.
display():To display all student details in doubly linked list.
(“X” denote Node to add in the doubly linked list).In the main ( ) function you have to do the following:
Create two objects of type StudentDetail at the Beginning of the doubly linked list class using addATBegining (X) method of DoublyLinkedList and use display() method to display doubly linked list.
Note that first object should contain your own VU ID and your own name otherwise you will get zero marks.Create one objects of type StudentDetail at the End of the doubly linked list class using addAtEnd (X) method of DoublyLinkedList and use display() method to display doubly linked list.
Delete current node of the doubly linked list and use display() method to display doubly linked list.
Display doubly linked list after calling each functions.
Detailed Output Screenshot:
Lectures Covered: This assignment covers Lecture # 18.
Deadline: Your assignment must be uploaded/submitted at or before 18Nov2019. 
Cs301 Today paper
Q1.biner tree bnawa tha OS k levels btao.
Q2.carictrics of avl tree.
Q3.if node leaf and non leafe in binry tree then what the hight of tree of its depth is 7?
Q.4hight of nodes if hight is 5?
Q.6 [2 9 7 5 8] sort it.
Q.7 ik tree tha osko array mn conert krna tha.
Q8.crictristics of union method
Mostly mcqs and questions are from moazz files.
Shared By @Awais
The objective of this assignment is

o Binary Search trees
o AVL trees
o Rotation cases of AVL trees
o Balancing Factor of trees 
@zareen said in The objective of this assignment is:
o Binary Search trees
Binary Search Tree (BST) –
BST is a special type of binary tree in which left child of a node has value less than the parent and right child has value greater than parent. Consider the left skewed BST shown in Figure 2.
Searching: For searching element 1, we have to traverse all elements (in order 3, 2, 1). Therefore, searching in binary search tree has worst case complexity of O(n). In general, time complexity is O(h) where h is height of BST.
Insertion: For inserting element 0, it must be inserted as left child of 1. Therefore, we need to traverse all elements (in order 3, 2, 1) to insert 0 which has worst case complexity of O(n). In general, time complexity is O(h).
Deletion: For deletion of element 1, we have to traverse all elements to find 1 (in order 3, 2, 1). Therefore, deletion in binary tree has worst case complexity of O(n). In general, time complexity is O(h).