Navigation

    Cyberian
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Pro Blog
    • Users
    • Groups
    • Unsolved
    • Solved
    Quiz 100% Result
    • CS301 GDB 1 Solution and Discussion

      zaasmi

      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!

      CS301 – Data Structures
    • The objective of this assignment is

      zareen

      o Binary Search trees
      o AVL trees
      o Rotation cases of AVL trees
      o Balancing Factor of trees

      CS301 – Data Structures
    • CS301 Assignment 1 Solution and Discussion

      zaasmi

      Re: CS301 Assignment 1 Solution and Discussion

      Assignment No. 01

      Semester Spring 2020
      CS301- Data Structures
      Total Marks: 20

      Due 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 Dev-C++ IDE.
      Objective
      The objective of this assignment is

      o To make you familiar of programming with stack data structure.

      For any query about the assignment, contact at [email protected]

      GOOD LUCK

      Marks: 20

      You 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:
      7722eec0-3d47-4dfa-8e49-af71bc5276df-image.png

      Out Put 2:
      aeb43ac0-afd4-4ce3-9c15-6440d6bfb4d9-image.png

      Output 3:
      e51ed70a-a3a2-44b1-ae5a-d9e4c2c8f17a-image.png

      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 # 1-7.
      Deadline: Your assignment must be uploaded/submitted at or before, 1 June 2020
      CS301 – Data Structures
    • CS301 Assignment 3 Solution and Discussion

      zaasmi

      Re: CS301 Assignment 3 Solution and Discussion

      Assignment No. 03

      SEMESTER 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 instructions

      o 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 trees

      For any query about the assignment, contact at [email protected]
      GOOD LUCK
      Marks: 20

      Problem 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 # 15-26
      Deadline: Your assignment must be uploaded/submitted at or before January 21 , 2021

      CS301 – Data Structures
    • CS301 Assignment 2 Solution and Discussion Spring 2020

      zaasmi

      Re: CS301 Assignment 2 Solution and Discussion

      Assignment No. 02

      Spring 2020
      CS301- Data Structures
      Total Marks: 20

      Due Date: 17-Jun-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:
       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 Dev-C++ 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 BST

      For any query about the assignment, contact at [email protected]

      Good Luck!

      Total Marks: 20

      Problem 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 sub-tree. Otherwise, it will be added to the right sub-tree. So, the BST will have numbers (or nodes) less than the root in the left sub-tree and the numbers greater than the root will be in the right sub-tree.

      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.
      cf5cdf06-c8b4-453d-ae6a-ae97d76ff228-image.png

      You must call the above-mentioned 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:
      c8d35aaf-4090-460e-b4df-1d5c470a872d-image.png

      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.

      CS301 – Data Structures
    • CS301 GDB 1 Solution and Discussion

      zareen

      CS301 GDB 1 Solution and Discussion

      CS301 – Data Structures
    • CS301 Assignment 2 Solution and Discussion

      zareen

      Assignment No. 02
      SEMESTER Fall 2019
      CS301- Data Structures
      Total Marks: 20

      Due Date: 29-Nov, 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 Dev-C++ IDE.
      Objective
      The objective of this assignment is

      o 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.

      793f564b-bafc-4c4b-8a42-1ddaf5058848-image.png

      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.
      d83ecb32-2d3d-4a30-bbe5-65f21401bbc0-image.png

      For Students Id’s having Even number in last of your id.
      a7616a16-9840-485c-9039-dbe5517aeae3-image.png

      Lectures Covered: This assignment covers Lecture # 1-14.
      Deadline: Your assignment must be uploaded/submitted at or before 29-Nov, 2019.

      CS301 – Data Structures
    • CS301 Assignment 3 Solution and Discussion

      zareen

      Assignment No. 03
      Fall 2019
      CS301 - Data Structures
      Total Marks: 20

      Due Date: 21-1-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 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 Dev-C++, 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.
      9aab7e1d-84a7-4700-a725-d558070fc0b6-image.png

      Important Note: Use Dev-C++, Version 5.11 or above.
      Deadline: Your assignment must be uploaded/submitted at or before 21-1-2020.

      CS301 – Data Structures
    • CS301 Quiz 1 Solution and Discussion

      zareen

      Share your current Quiz Data

      CS301 – Data Structures
    • CS301 Assignment 1 Solution and Discussion

      zareen

      Assignment No. 01
      Semester Fall 2019
      CS301- Data Structures Total Marks: 20

      Due Date : 18-Nov-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 Dev-C++ IDE.
      Objective
      The objective of this assignment is

      o 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
      vuid

      A node class named as “Node” by using class keyword.
      Node class will have following data members and member functions:
      cda47932-36ec-4210-ab0a-b3bee8bce8dc-image.png

      (“X” denotes StudentDetail variable means the student details and “Y” denotes the data value of the node).

      A doubly linked list class named as “DoublyLinkedList” by using class keyword.
      DoublyLinkedList class will have following data members and member functions:
      a46ffa50-421f-4ab2-9d20-67bfac975435-image.png

      Detailed description of member functions of DoublyLinkList class:

      addAtBegining(X): To add the node at the beginning of the doubly linked list class.
      4da1ea58-b161-48f7-98b0-9684d220156b-image.png

      addAtEnd(X): To add the node at the End of the doubly linked list class.
      08b97a59-7a5e-4312-9d83-5cdb81890a8f-image.png

      delNode(): To delete a node pointed by current pointer in the doubly linked list.
      59d9f4dd-919a-4db9-991a-950c4d6bb829-image.png

      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:
      fcd2ba41-d1ae-4c73-9648-8180c609cba1-image.png

      Lectures Covered: This assignment covers Lecture # 1-8.
      Deadline: Your assignment must be uploaded/submitted at or before 18-Nov-2019.

      CS301 – Data Structures
    • CS301 Final Term Current Paper

      zareen

      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

      CS301 – Data Structures

    The objective of this assignment is

    CS301 – Data Structures
    avl trees balancing factor of trees binary search trees cs301 rotation cases of avl trees
    1
    2
    35
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • zareen
      zareen Cyberian's Gold last edited by

      o Binary Search trees
      o AVL trees
      o Rotation cases of AVL trees
      o Balancing Factor of trees

      zareen 1 Reply Last reply Reply Quote 0
      • zareen
        zareen Cyberian's Gold @zareen last edited by zareen

        @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.
        38f0c7fc-691d-4731-811e-528ccf01a075-image.png

        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).

        1 Reply Last reply Reply Quote 0
        • First post
          Last post

        50% Off on Your FEE Join US!

        Quiz 100% Result If you want to know how you can join us and get 50% Discout on your FEE ask Cyberian in Chat Room! Quiz 100% Result Quiz 100% Result
        solution1241 discussion1194 fall 2019813 assignment 1425 assignment 2295 spring 2020265 gdb 1246 assignment 382 crw10174 spring 201955
        | |
        Copyright © 2021 Cyberian Inc. Pakistan | Contributors
        Live Chat