Showing posts with label CS301. Show all posts
Showing posts with label CS301. Show all posts

CS301 Assignment no 3 Solution Fall 2016

By: // No comments:

CS301 Assignment no 3 Fall 2016

Here we have CS301- Data Structures Assignment  No. 3 Solution and discussion, Fall 2016, Total Marks: 15, Due Date: 20/01/2017.

You Can Also Download CS301 Solved Final Term Papers, CS301 Short Notes, CS301 Assignment Solutions, Lecture Wise Questions Answers Files, Solved MCQs, Solved Quiz ,CS301 Solved Final Term Subjective Papers ,CS301 Solved Final Term Objective Papers from Virtual Study Solutions For Preparation of Final Term Papers.

Also Read: CS302 Short Notes for Final term Preparation

CS301 Assignment  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 Ms Word 2003 file.
  • The submitted assignment does NOT open or file is corrupted.
  • The assignment is copied (from other student or ditto copy from handouts or internet).
Also Read: Write ALLAH Using C++ Program

CS301 Assignment Uploading instructions

For clarity and simplicity, You are required to Upload/Submit only Ms Word file (.doc or docx format).

Note: Use ONLY Microsoft Word

CS301 Assignment Objective

The objective of this assignment is,

To make you familiar with concept of Huffman Encoding.

For any query about the assignment, contact at cs301@vu.edu.pk

CS301 Assignment Statement:

Question 1: [Marks 15]

While transmission through network, it is always important to keep data transmission rate high so data over the network can be increased using two ways; either increases the bandwidth of communication channel or decrease the size of data (compression) to increase the bandwidth utilization.

Lossless data compression algorithms are important in network and Huffman encoding scheme can be used for lossless data compression. Suppose the following string is being transmitted over the network:

“Data Compression in data structure”

We cannot increase the bandwidth of communication channel. Instead we have to compress the given string. Use Huffman encoding scheme to encode the given string.

To encode the string:

Build a table containing the following information about the string.

Build Huffman encoding tree. The tree will be built with the help of characters and their respective frequencies which you will find in step 1.

Calculate how much bits are consumed by original and compressed string. What percentage of bits is saved by Huffman encoding scheme?

Mention step by step construction of Huffman Encoding tree from the above table.

Also ReadHOW TO TAKE QUIZ ON LMS

CS301 Assignment no 3 Solution

  • Please Wait.
  • Assignment Solution of CS301 will be updated Soon.
If You want to receive the Solution directly in your inbox. Please Subscribe below or like us on Facebook.

CS301 Current Mid Term Papers Fall 2016

By: // No comments:

CS301 Current Mid Term Papers Fall 2016

Here are CS301 All Current Mid Term Papers of Fall 2016 And Past Mid Term Papers from 17 December 2016 to 29 December 2016.
You Can Also Download CS301 Solved Mid Term Papers, Short Notes, CS301 Assignment Solutions, Lecture Wise Questions Answers Files, Solved MCQs, Solved Quiz , CS301 Solved Mid Term Subjective Papers , CS301 Solved Mid Term Objective Papers From This Discussion For Preparation Mid Term Papers of Fall 2015-16.


I m going to Share Cs301 current midterm papers 17 dec to 29 DEC sent to us from Virtual University Students:

CS301 Current Mid Term Paper - Sample 1:

Today's paper of CS301 Dated: 17/12/2016
  1. What is template? give short answer. 
  2. part1: 2 Advantages of list over arrays
  3. part2: binary state in whicj singly link list is used?
  4. a diagram was given and asked to perform double rotation and balance the tree 
  5. output of function 
  6. output of function stack and que mix
  7. MCQs were easy
Also Read: Eco 401 lectures short questions and answer

CS301 Current Mid Term Paper - Sample 2:

Today CS301 mid term Dated : 17/12/2016
  1. c++ template definition
  2. avl tree condition
  3. pop and push code 
  4. In order traversal code .can we write a code with out recursion if so than write that data structure and explain ..
Also Read: ISL201 Islamic Studies Short questions for quiz and exams

CS301 Current Mid Term Paper - Sample 3:

  1. array and linked list k disadvantages
  2. AVL tre banana. values were given
  3. Queue say related questions 
  4. BST k operations
exam was very easy mcqs were from past papers. long Questions were also easy. There were no coding related questions asked. further more i don't remember. 

Also Read: MTH202 Past Final Term Papers

CS301 Current Mid Term Paper - Sample 4:

  1. In AVL insertion. What are cases in which cases in which single rotation is possible?
  2. Suppose we want 2 find a name in a directory having 100000 entries. What is the best method linear or non-linear.
  3. ab-cd. Post fix method.
  4. Write linked list function to remove-first () to remove the first element of linked list.
Also Read: ISL 201 Mid term SOlved Papers

CS301 Current Mid Term Paper - Sample 5:

  1. Disadvantages of AVL
  2. Uses of Priority of Q
  3. AVL placement without step
  4. binary search tree
  5. data structure and array data structure
Also Read: CS101 Mid term 16 SOlved Papers + Quizzes + Solved Subjectives + HTML TAGS

CS301 Current Mid Term Paper - Sample 6:

CS301 Current Mid Term Paper Question no 1

CS301 Current Mid Term Paper Question no 2

CS301 Current Mid Term Paper Question no 3

CS301 Current Mid Term Paper Question no 4


CS301 Current Mid Term Paper Question no 7


CS301 Current Mid Term Paper Question no 9

CS301 Current Mid Term Paper Question no 10

CS301 Current Mid Term Paper Question no 11

CS301 Current Mid Term Paper Question no 12

CS301 Current Mid Term Paper Question no 13


CS301 Current Mid Term Paper Question no 14

CS301 Current Mid Term Paper Question no 15


CS301 Current Mid Term Paper Question no 16

CS301 Current Mid Term Paper Question no 17

CS301 Current Mid Term Paper Question no 18

IF You liked This Post Please Share it with Other Students and don't forget to Subscribe Virtual Study Solutions for More past papers and Helping material related to Study. Thanks

CS301 Assignment No. 2 Solution Fall 2016

By: // No comments:

CS301 Assignment No. 2 Fall2016

CS301 - Data Structures Assignment No. 2 Solution Fall 2016 Due Date: Nov 29, 2016
CS301 Assignment No. 2
Semester: Fall 2016
CS301 – Data Structures
CS301 Assignment Total Marks: 20
CS301 Assignment Due Date: Tuesday, November 29, 2016


Also Read: CS502 Assignment No. 02 Solution Fall 2016

CS301 Assignment Instructions

Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:

  • Assignment is submitted after due date.
  • Submitted assignment does not open or file is corrupt.
  • Assignment is copied (From internet/ to from students).
For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file. Other format will not be accepted and will be graded zero marks.
Note: Use ONLY Dev-C++ IDE for writing and executing your code.

Also Read : Free Microsoft Office Specialist (MOS) for Virtual University

CS301 Assignment Objectives:

The purpose of this assignment is to make you familiar with following topics:
  • Tree
  • Binary Tree
  • Terminologies of a Binary Tree
  • Level
  • Complete Binary Tree
  • Level of a Complete Binary Tree
Also Read: PM Laptop Scheme for Virtual University Students 2016-17

CS301 Assignment Submission Instructions

You have to submit only .cpp on the Assignments interface of CS301 at VULMS. Assignment submitted in any other format will not be accepted and will be graded zero marks.

CS301 Assignment No. 2

Marks= 20

CS301 Assignment Question 1: 

Write down C++ code to create a complete binary Tree in which user can add any number of node/elements (Numeric). After Creating a complete binary tree , You need to calculate the product of the 2nd lowest level and find the smallest number in the binary tree as given in the example:

CS301 Assignment No. 2 Solution Fall 2016

Product of Elements in 2nd last level (N-1)= 20

Smallest number in Binary Tree = 2

Note: N levels mean any number of levels.

CS301 Assignment Deadline:

Your assignment must be uploaded on or before Tuesday, November 29, 2016. We shall not accept your solution through email after the due date.

Also Read: financial accounting MGT101 Solved Papers



CS301 Assignment No. 2 Solution Fall 2016

Here You can download CS301 Assignment No. 2 Solution & Discussion for Fall 2016.

CS301 Assignment No. 2 Solution

#include <stdio.h>
#include <iostream>
using namespace std;
struct Node
{
int val;
struct Node *left, *right;
};
Node *newNode(int data)
{
Node *temp = new Node;
temp->val = data;
temp->left = temp->right = NULL;
return temp;
}
// A utility function to find deepest leaf node.
// lvl: level of current node.
// maxlvl: pointer to the deepest left leaf node found so far
// isLeft: A bool indicate that this node is left child of its parent
// resPtr: Pointer to the result
void deepestLeftLeafUtil(Node *root, int lvl, int *maxlvl,
bool isLeft, Node **resPtr)
{
// Base case
if (root == NULL)
return;
// Update result if this node is left leaf and its level is more
// than the maxl level of the current result
if (isLeft && !root->left && !root->right && lvl > *maxlvl)
{
*resPtr = root;
*maxlvl = lvl;
return;
}
// Recur for left and right subtrees
deepestLeftLeafUtil(root->left, lvl+1, maxlvl, true, resPtr);
deepestLeftLeafUtil(root->right, lvl+1, maxlvl, false, resPtr);
}
// A wrapper over deepestLeftLeafUtil().
Node* deepestLeftLeaf(Node *root)
{
int maxlevel = 0;
Node *result = NULL;
deepestLeftLeafUtil(root, 0, &maxlevel, false, &result);
return result;
}
Node* insert(Node* node, int val)
{
/* 1. If the tree is empty, return a new,
single node */
if (node == NULL)
return(newNode(val));
else
{
/* 2. Otherwise, recur down the tree */
if (val <= node->val)
node->left = insert(node->left, val);
else
node->right = insert(node->right, val);
/* return the (unchanged) node pointer */
return node;
}
}
int minValue(Node* node) {
Node* current = node;
/* loop down to find the leftmost leaf */
while (current->left != NULL) {
current = current->left;
}
return(current->val);
}
// Driver program to test above function
int main()
{
int a, b, c, d, e, f, g, h, i, j;
cout"Enter 10 Numbers in Tree:\n";
cin>>a>>b>>c>>d>>e>>f>>g>>h>>i>>j;
Node* root = newNode(a);
root->left = newNode(b);
root->right = newNode(c);
root->left->left = newNode(d);
root->right->left = newNode(e);
root->right->right = newNode(f);
root->right->left->right = newNode(g);
root->right->right->right = newNode(h);
root->right->left->right->left = newNode(i);
root->right->right->right->right = newNode(j);
root = insert(root, a);
insert(root, b);
insert(root, c);
insert(root, d);
insert(root, e);
insert(root, f);
insert(root, g);
insert(root, h);
insert(root, i);
insert(root, j);
Node *result = deepestLeftLeaf(root);
if (result){
cout "Product of 2nd lowest level of a binary tree is: " result->val * result->val;
}
else{
cout "There is no left leaf in the given tree";
}
printf("\nMinimum value in BST is %d", minValue(root));
return 0;
}

Download CS301 Solution file:


CS301 Solution 2 Fall 2016- By_irfan.cpp, 3 KB9

CS301 Assignment no 1 Solution Fall 2016

By: // 4 comments:

CS301 Assignment no 1

Here You can easily download CS301 Assignment Solution - Data Structures. CS301 Assignment No. 1 Semester: Fall 2016CS301 Data Structures .CS301 Assignment Total Marks: 20. CS301 Assignment Due Date: November 16, 2016.

CS301 Assignment Instructions

Please read the following instructions carefully before submitting assignment:
It should be clear that your assignment will not get any credit if:

  • Assignment is submitted after due date.
  • Submitted assignment does not open or file is corrupt.
  • Assignment is copied (From internet/ to from students).
You May also Read: CS401 Mid Term Past Papers / Notes

Note: For clarity and simplicity, You are required to Upload/Submit only ONE .CPP file if needed.
Keep all your files (word and .cpp) in a folder and make its zipped file to upload on LMS.
Use ONLY Dev-C++ IDE for writing and executing your code.
You May also Read: CS501 Assignment no. 01 Solution Fall 2016

CS301 Assignment Objectives:

The purpose of this assignment is to make you familiar with following topics:
  • Singly Linked List, Double Linked List and Circular Linked List
  • Infix to Postfix
  • C++ Templates
  • Implementation of Stack
  • Function Call Stack

CS301 Assignment Submission Instructions

You have to submit only word file on the Assignments interface of CS301 at VULMS. Assignment submitted in
any other format will not be accepted and will be graded zero marks.

You May also Read: CS201 Assignment No 01 Solution / Discussion Fall 2016

CS301 Assignment no. 1 Fall 2016

CS301 Assignment Question 1:

marks: 10
CS301 Assignment no 1 Solution Fall 2016
CS301 Assignment no 1 Question no 1 Fall 2016

Given is a code of abstract class declaration for a list (ADT) in Figure 1(a).

Figure 1(a)
(a) Assume a list has the following configuration: < | 2, 23, 15, 5, 9 >Write only Method calls (Name of function) using the List ADT of Figure 1(a) to delete the element with value
15.
e.g To move the pointer to end of the list We will use function movetoEnd( ). No need to write function implementation.

Note: Here the ‘|’ symbol represents ‘fence’ like pointer that indicates the current position of pointer in list.

(b)  Show the list configuration resulting from each series of list operations using the List ADT of Figure 1(a)

Assume that list L1 is empty at the beginning of each series. Show where the fence is in the list.

L1.append(10);
L1.append(20);
L1.append(15);

CS301 Assignment Question 2: 

marks: 10

Given is an infix expression:

A + B * C / (D-B)

Write a complete program in C++ to convert the above infix expression into postfix notation.

CS301 Assignment Deadline:

Your CS301 Assignment must be uploaded on or before November 16, 2016. We shall not accept your solution through email after the due date.

CS301 Assignment no 1 Solution Fall 2016

CS301 Solution Correct

CS301 Assignment Question no. 1 Solution:

#include
using namespace std;

struct node
{
int data;
struct node *next;
};

class stack
{
struct node *top;
public:
stack()
{
top=NULL;
}
void push();
void pop();
void show();
};

void stack::push()
{
int value;
struct node *ptr;
cout"Enter Item number to insert : ";
cin>>value;
ptr=new node;
ptr->data=value;
ptr->next=NULL;
if(top!=NULL)
ptr->next=top;
top=ptr;
cout"\n New item is inserted to the stack!!!";

}

void stack::pop()
{
struct node *temp;
if(top==NULL)
{
cout"\n The stack is empty!!!";
}
temp=top;
top=top->next;
cout"\n Remove Item \n ============ \n Item number " temp->data;
cout" is removed";
delete temp;
}

void stack::show()
{
struct node *ptr1=top;
cout"\n Pruchased Items are :\n";
while(ptr1!=NULL)
{
coutptr1->data" ->";
ptr1=ptr1->next;
}
cout"NULLn";
}

int main()
{
stack s;
int choice;
while(1)
{
cout"\n-------------- *Zohaib* -----------------\n------------- khan--------------------";
cout"\n------------- bc130201551---------------\n------------- Student Of BsCs----------------";
cout"\n ------------ Purchased Module -------------------------";
cout"\n MENU\n ====\n1:Insert Item\n2:Remove Item\n3:DISPLAY Purchased Item \n4:EXIT";
cout"\n Enter your choice(1-4): ";
cin>>choice;
switch(choice)
{
case 1:
s.push();
break;
case 2:
s.pop();
break;
case 3:
s.show();
break;
case 4:
return 0;
break;
default:
cout"Please enter correct choice(1-4)!!";
break;
}
}
return 0;
}

CS301 Assignment Question no. 2 Solution:

#include
#include//import Stack STL
#include//import String STL
#include
using namespace std;

string infixToPostfix(string expr); //Function declaration
int precendence(char arg);
bool isoperand(char arg);
bool isoperator(char arg);
int operatorweight(char arg);
bool highprecendence(char a, char b);

int main()
{
string exp;//Variable to get input expression
cout"Enter the infix expression:";
getline(cin,exp);
cout"Output Postfix Expression:"infixToPostfix(exp);
getch();
}

string infixToPostfix(string expr)//Function to perform all conversion operation
{

stack stk;//Declaring a stack for conversion purpose
string postfix = "";//Initialize the output string as empty;
for(int i = 0;i < expr.length(); i++)//Scan the infix string one by one
if(expr[i] == '(')
{
stk.push(expr[i]);
}
else if(expr[i] == ')')
{
while(stk.top() != '(')
{
postfix = postfix + stk.top();
stk.pop();
}
stk.pop();
}
else if(isoperand(expr[i]))
{
postfix += expr[i];
}
else if(isoperator(expr[i]))
{
while(!stk.empty()&& !highprecendence(expr[i],stk.top()))
{
postfix+= stk.top();
stk.pop();
}
stk.push(expr[i]);
}
while(!stk.empty())
{
postfix+= stk.top();
stk.pop();
}
return postfix;
}

bool highprecendence(char a, char b)//Check for operator precendence
{
int weighta = operatorweight(a);
int weightb = operatorweight(b);
if(weighta >= weightb) return 1;
return 0;
}

bool isoperator(char arg)//Check weather the character is operator
{
if(arg == '*' || arg == '/' || arg == '+' || arg == '-') return(1);
else return(0);
}
bool isoperand(char arg)//Check weather the character is operand
{
if(arg >= '0' && arg <= '9') return 1;
if(arg >= 'a' && arg <= 'z') return 1;
if(arg >= 'A' && arg <= 'Z') return 1;
return 0;
}

int operatorweight(char arg)//Add weight to the operator
{
int weight = 0;
switch(arg)
{
case '*':
case '/':
weight = 2;
break;
case '+':
case '-':
weight = 1;
break;
}
return(weight);
}

Download Links for CS301 Assignment Files:

Untitled4.cpp, 2 KB
Untitled4.exe, 1.9 MB