Group Details Private

Global Moderators

Forum wide moderators

Member List

  • Which is correct food or foods?

    plural noun: foods
    any nutritious substance that people or animals eat or drink or that plants absorb in order to maintain life and growth.

    posted in General Discussion
  • Virtual University must hold exams... (Poll)
    posted in Virtual University
  • RE: The objective of this assignment is

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

    posted in CS301 – Data Structures
  • The objective of this assignment is

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

    posted in CS301 – Data Structures
  • RE: CS301 Assignment 1 Solution and Discussion

    @zareen
    100% Solution Code

    #include <iostream>
    using namespace std;
    
    /* The Student class */
    class Student {
    	private:
    		string firstname, lastname, VUID;
    		int marks;
    		Student *nextStudent;
    		
    	public:
    		// constructor of Student class to initialize data members of class   
            Student(){
            	VUID = "";
                marks = 0;
    			firstname = "";
                lastname = "";            			
                nextStudent = NULL;
            }        
            
            // Student class method to set VU  ID of Student
            void setVUID(string val){
                VUID = val;
            };
            
            //Student class method to get VU ID of Student
            string getVUID(){
                return VUID;
            }; 
                
            // Student class method to set first name of Student
            void setFirstName(string val){
                firstname = val;
            };
            
            //Student class method to get first name of Student
            string getFirstName(){
                return firstname;
            }; 
            
            // Student class method to set last name of Student
            void setLastName(string val){
                lastname = val;
            };
            
            //Student class method to get last name of Student
            string getLastName(){
                return lastname;
            };
            
            //Student class method to set the Marks of Student
            void setMarks(int val) { 
                marks = val; 
            };
    		// Student class method to get the Marks of Student
            int getMarks() { 
                return   marks; 
            }
            
            //Student class method to point current Student to next Student
            void setNext(Student *nextStudent) {
            	this->nextStudent   =   nextStudent; 
            }
            
            // Student class method to get memory address where pointer is pointing
            Student *getNext() { 
                return   nextStudent; 
            }       
    };
    
    /* The List class */
    class List {
    	
    	private:
    		Student *   head;
            Student *   current;
        
        public:
            // constructor of list class to initialize data members of class
            List() {            
                head   =   new Student();
                head->setNext(NULL);
                current   =   NULL;          
            }                
            
            // list class method to add Students into list
            void   add() {
                Student *newStudent = new Student();
                int loc_marks = 0;
                string loc_vuid = "", loc_fname = "", loc_lname = "";
                
                cout<<"\nEnter VU ID: ";
                cin>>loc_vuid;
                newStudent->setVUID(loc_vuid);
                
                cout<<"Enter Marks: ";
                cin>>loc_marks;
                newStudent->setMarks(loc_marks); 
                
                cout<<"Enter First Name: ";
                cin>>loc_fname;
                newStudent->setFirstName(loc_fname);
                
                cout<<"Enter Last Name: ";
                cin>>loc_lname;
                newStudent->setLastName(loc_lname);
               
                if(head->getNext() == NULL){
               		newStudent->setNext(NULL);
                   	head->setNext(newStudent);               	
                   	current   =   newStudent;
    		    }
    		    else{
    		    	Student *temp = head;
    		    	while(temp->getNext() != NULL && temp->getNext()->getMarks() >= loc_marks){
    		    		temp = temp->getNext();
    				}
    				current = temp;
    				newStudent->setNext(current->getNext());
                   	current->setNext( newStudent );               	
                   	current   =   newStudent;
    		   }         
            };        
    
            // list class method to get the information of Student
            void getInfo() { 
                if (current  !=  NULL){
    				cout<<"VU ID: "<<current->getVUID()<<endl;
    	            cout<<"Marks: "<<current->getMarks()<<endl;				 
    				cout<<"First Name: "<<current->getFirstName()<<endl;
    				cout<<"Last Name: "<<current->getLastName()<<endl<<endl;				
    			}
            };				          
                   
            // list class method to move current to next Student
            bool next() {
                if (current  ==  NULL){
                    return  false;
                }  
                current  =  current->getNext();            
            };
            
            // frient function to list class to show all students in the list
            friend void showStudents(List list){
                Student* savedCurrent  =  list.current;
                list.current  =  list.head;
                
                for(int i = 1; list.next(); i++){			
    				list.getInfo();          
    			}
                list.current  =  savedCurrent;
            };
    };
        
    main() {
    	int input = 0;
        List lst;      
        
        while(input != -1) {
            
            cout<<"1. To Add New Student in Ranking"<<endl;
            cout<<"2. To Display Ranking"<<endl;
            cout<<"3. To Close"<<endl<<endl;
            cout<<"Enter Your Choice: (1, 2 or 3) ";
            cin>> input;
            
            if(input == 1) {
            	lst.add();
    			cout<<"Student's information saved successfully.\n"; 
            }
            else if(input == 2) {
            	cout<<"\nRanking Chart"<<endl;
                showStudents(lst);
                return 0;
            }
            else {
            	return 0;
            }		
    	}
    }
    
    
    posted in CS301 – Data Structures
  • RE: CS301 Assignment 1 Solution and Discussion

    Data Structures (CS301)
    Assignment # 01
    Semester Fall 2020
    Total Marks = 20
    Deadline Date
    26th Nov 2020

    Please carefully read the following instructions before attempting assignment.
    RULES FOR MARKING
    It should be clear that your assignment would not get any credit if:
    • The assignment is submitted after the due date.
    • The submitted assignment does not open or file is corrupt.
    • Strict action will be taken if submitted solution is copied from any other student or from the internet.

    Lectures:

    • Lectures 1 to 7 are covered in this assignment
    NOTE
    No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least one day before its closing date.
    If you people find any mistake or confusion in assignment (Question statement), please consult with your instructor before the deadline. After the deadline no queries will be entertained in this regard.
    For any query, feel free to email at: [email protected]

    Problem Statement:
    Suppose you are asked to make a Ranking information chart of students in a dynamic list called linked list using C++ language. The data will be stored in this list in order i.e. the highest marks student will be on top position with other information whereas the next highest marks student will be on second top position and so on.
    Your program will get the information of a student in the form of input (Student ID, Name, Marks) through console. After filling the required information, the student will be inserted in linked list at right place. The right place of student will be decided on the basis of marks.
    Furthermore, you are required to use only classes for this assignment. As we are not covering Struct in this course so using it in assignment solution is not allowed.
    Sample Output:
    See the gif file attached with this assignment file.

    Note:
    DO REMEMBER that you must use your VUID as an input in this program.

    Submission details
    Following Files Must be submitted in a single zip or rar file.
    • C++ code file (file name should be your VUID)
    • A .gif file which shows only “execution” of your Application (For Recording .gif a software named Screentogif is uploaded on LMS, or you can use any other gif recording tool as well)
    • First record must be with your own VU-ID in .gif file.
    If you do not submit any of the above-mentioned file or use some other VU-ID, you will be awarded Zero Marks.

    “The End”

    Solutionvid3.gif

    posted in CS301 – Data Structures
  • RE: CS301 Assignment 3 Solution and Discussion posted in CS301 – Data Structures
  • RE: CS301 Assignment 3 Solution and Discussion

    posted in CS301 – Data Structures
  • CS301 Assignment 3 Solution and Discussion

    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:

    1. 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.
    2. Show and perform necessary rotations where needed.
    3. 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

    posted in CS301 – Data Structures
  • RE: ISL 201 GDB 1 Solution and Discussion

    @zaasmi said in ISL 201 GDB 1 Solution and Discussion:

    @tahera-irum said in ISL 201 GDB 1 Solution and Discussion:

    Obedience of Allah Almighty

    O ye who believe! Obey Allah, and obey the Messenger, and those charged with authority among you. If ye differ in anything among yourselves, refer it to Allah and His Messenger, if ye do believe in Allah and the Last Day: That is best, and most suitable for final determination.

    obedience of Allah allmighty

    By obeying Allah SWT and His Messenger, we can know what good things or bad things for our lives. So, if we always obey to Allah Subahnahu Wa Ta’ala, we must get many rewards from Him. By obeying Allah Subhanahu Wa Ta’ala, we know what things are Allah’s commands and His prohibitions

    “O you who have believed, obey Allah and obey the Messenger and those in authority among you. And if you disagree over anything, refer it to Allah and the Messenger, if you should believe in Allah and the Last Day. That is the best [way] and best in result.” (Q.S. An-Nisa : 59)

    posted in ISL201 - Islamic Studies