CS301 Assignment Solution Spring 2020 | VU Assignments Solution


CS301 Assignment Solution Spring 2020 | VU Assignments Solution




CS301 Assignment Solution Spring 2020
If U Found Any Mistake Then Correct Your Self



Lab 1
Lab Title: Learn to implement linked list data structure

Tool: Dev C++
Description:
Write the C++ code to implement the List class. You need to write only add( ). remove( ), and find( ) functions of the list class.

SOlution of this assignment is following code you just put this code in the dev c+ and save that file.
class Node {

               
                private:
                                // Data part and pointer part of a node
        int number;
        Node *nextNode;

    public:
                //To get and set data of node
        int get() {return number;};
        void set(int number) {this->number = number;};

        //To get address of next node in the linked list
        Node *getNext() {return nextNode;};
        void setNext(Node *nextNode){this->nextNode = nextNode;};     
};


list.cpp file:
#include "Node.cpp"

class List{
               
    private:
        int size;
        Node* headNode;
        Node* currentNode;
        Node* lastCurrentNode;

    public:
List(){
headNode = new Node();
headNode->setNext(NULL);
currentNode = NULL;  
lastCurrentNode = NULL ;
               size = 0;
        }

        void add(int addNumber){
            Node *newNode = new Node();
newNode->set(addNumber);

            if (currentNode != NULL){
newNode->setNext(currentNode->getNext());
currentNode->setNext(newNode);
lastCurrentNode = currentNode;
currentNode = newNode;
            }
else{
newNode->setNext(NULL);
headNode->setNext(newNode);
lastCurrentNode = headNode ;
currentNode = newNode ;
            }
               size ++ ;
        }

        void remove(){
                //store locations of cur and lastcur pointers
                Node *tempCurNode = currentNode;
                Node *templstCurNode = lastCurrentNode;
               
                //Move pointers to start of the list
                currentNode = headNode->getNext();
                lastCurrentNode = headNode;
               
            if (currentNode != NULL &&currentNode != headNode){
                lastCurrentNode->setNext(currentNode->getNext());
                delete currentNode;
                size--;
                                                }
                                               
                                                //Re-assign the positions again to current node and lastcurrentnode
                                                currentNode = tempCurNode;
                                                lastCurrentNode = templstCurNode;
               
        }

        void find(List list, int x){
                                               
                                                Node* savedCurrentNode = list.currentNode;
                                                list.currentNode = list.headNode;
                                                int f = 0 ;
                                               
                                                while( list.next()){
                                                                if (x == list.get()){
                                                                                cout<<"\n Element " << x << " is found \n" ;
                                                                                f = 1 ;
                                                                }
                                                }
                                                if (f !=1)
                                                                cout<< "\nElement is not found in the list\n";
                                                               
                                                list.currentNode = savedCurrentNode;
                                }

        bool next(){
            if (currentNode==NULL) return false;

lastCurrentNode = currentNode;
currentNode = currentNode->getNext();
            if (currentNode==NULL || size==0)
            return false;

            else
                return true;
        }

        int get(){
            if (currentNode != NULL)
            return currentNode->get();
        }

        void start() {
                lastCurrentNode = headNode;
                currentNode = headNode;
                                }      

};

link_list.cpp:
#include<iostream>
using namespace std;
#include "list.cpp"
main(){

               
                //Created a list object.
                List list;
                int x ;

                //Adding values to the list
                cout<< "Added numbers to the list: \n";
                list.add(5);
                list.add(13);
                list.add(4);
                list.add(8);
                list.add(24);
                list.add(48);
                list.add(12);
               
                //Calling the start method of the list
                list.start();
                //Printing all the element of the list
                while(list.next())
                                cout<<"List Element:"<<list.get()<<endl;
                cout<<"_____________________\n";
               
                cout<< "Removed First three elements from the list after that\n";          
                list.remove();
                list.remove();
                list.remove();
                list.start();
                while(list.next())
                                cout<<"List Element:"<<list.get()<<endl;
                cout<<"_____________________\n";
               
                cout<< "Enter the number to be searched: " ;
                cin>>x ;
                list.start();
                list.find(list, x );
                system("pause");
}

Output images are:


CS301 Assignment Solution Spring 2020 | VU Assignments Solution

















VU Assignment CS601 For Data Communication | Spring 2020 | VU-LMS

VU Assignment CS601 For Data Communication | Spring 2020 VU-LMS



Scenario:

Suppose Prime Ministers (PMs) of two countries (ABC and XYZ) are holding an important meeting through video conferencing. The native languages of both countries are different; however, both the PMs have agreed upon to use English language for discussion. There are two meeting Halls (Hall-1 and Hall-2) in PM house of ABC country, both having different computer networks. Hall-1 has a computer network of 18 computers where each computer is directly connected to other computer in the network whereas Hall-2 has 8 computers connected with each other through a self-deciding central device to forward data only to intended destination, and the same hall has been used for the meeting of the PMs. Both the halls are connected with each other through an intermediary networking device. Meeting is being held in a smooth flow where each PM can listen and speak to each other at the same time.
After carefully reading the above scenario, give the answer of each of the question given in the following table:
S. No.
Question
Answer
1
Which type of topology is used in the Hall-1? Mesh Topology

2
What is total number of links required in the identified topology for the Hall-1?
 N(N-1)/2
18(18-1)/2
18(17)/2
306/2=
153

3
What is total number of ports being used in the identified topology in the Hall-1?
n-1
18-1=17

4
What computer topology is being used in the Hall-2?star topology

5
Identify the connecting device that is being used in the identified topology for the Hall-2?  central hub

6
Which category (geographical wise) of network exists is in Hall-1? LAN

7
Which category (geographical wise) of network exists is in Hall-2? LAN

8
Identify the type of network being created when the networks of both countries are connected with each other for meetings of PMs.

 WAN

9
Identify the communication mode which is enabling both the PMs to listen and speak to each other at the same time?
Full Duplex Transmission

10
Which layer’s device will be used to connect the networks of both countries for video conferencing?

Physical Layers



Best of Luck!


VU Assignment CS601 For Data Communication | Spring 2020 VU-LMS