Ignou Bcsl-033 Solved Assignment Cs

BACHELOR OF COMPUTER APPLICATIONS

Course Code : BCSL-033
Course Title : Data and File Structures Lab
Assignment Number : BCA(3)/L-033/Assignment/17-18
Maximum Marks : 50
Weightage : 25%

Write an algorithm and program that accepts a Binary Tree as Input and Checks if the input Binary tree is Complete Binary Tree or a Full Binary Tree and prints appropriate message – IGNOU BCA Assignment 2017 – 18

CODE:

#include<stdio.h>
#include<stdlib.h>

/* Tree node structure */
struct Node
{
int key;
struct Node *left, *right;
};

/* This function counts the number of nodes in a binary tree */
int countNodes(struct Node* root)
{
if (root == NULL)
return (0);
return (1 + countNodes(root->left) + countNodes(root->right));
}

/* This function checks if the binary tree is complete or not */
int isComplete (struct Node* root, int index,int number_nodes)
{
// An empty tree is complete
if (root == NULL)
return (1);

// If index assigned to current node is more than
// number of nodes in tree, then tree is not complete
if (index >= number_nodes)
return (0);

// Recur for left and right subtrees
return (isComplete(root->left, 2*index + 1, number_nodes) &&
isComplete(root->right, 2*index + 2, number_nodes));
}
/* Helper function that allocates a new node with the
given key and NULL left and right pointer. */
struct Node *newNode(char k)
{
struct Node *node = (struct Node*)malloc(sizeof(struct Node));
node->key = k;
node->right = node->left = NULL;
return node;
}

/* This function tests if a binary tree is a full binary tree. */
int isFullTree (struct Node* root)
{
// If empty tree
if (root == NULL)
return (1);

// If leaf node
if (root->left == NULL && root->right == NULL)
return (1);

// If both left and right are not NULL, and left & right subtrees
// are full
if ((root->left) && (root->right))
return (isFullTree(root->left) && isFullTree(root->right));

// We reach here when none of the above if conditions work
return (0);
}

// Driver Program
void main()
{
struct Node* root = NULL;
unsigned int node_count;
unsigned int index;

clrscr();
root = newNode(10);
root->left = newNode(20);
root->right = newNode(30);

root->left->right = newNode(40);
root->left->left = newNode(50);
root->right->left = newNode(60);
root->right->right = newNode(70);

root->left->left->left = newNode(80);
root->left->left->right = newNode(90);
root->left->right->left = newNode(80);
root->left->right->right = newNode(90);
root->right->left->left = newNode(80);
root->right->left->right = newNode(90);
root->right->right->left = newNode(80);
root->right->right->right = newNode(90);

node_count = countNodes(root);
index = 0;

if (isComplete(root, index, node_count))
printf(“\nThe Binary Tree is complete\n”);
else
printf(“\nThe Binary Tree is not complete\n”);

if (isFullTree(root))
printf(“\nThe Binary Tree is full\n”);
else
printf(“\nThe Binary Tree is not full\n”);

getch();

 

SCREENSHOTS:

#include<stdio.h>#include<stdlib.h>/* Tree node structure */struct Node {int key;struct Node *left,*right;};/* This function counts the number of nodes in a binary tree */int countNodes(struct Node* root){if(root == NULL)return(0);return(1 + countNodes(root->left)+ countNodes(root->right));}/* This function checks if the binary tree is complete or not */int isComplete (struct Node* root,int index,int number_nodes){// An empty tree is completeif(root == NULL)return(1);// If index assigned to current node is more than// number of nodes in tree, then tree is not completeif(index >= number_nodes)return(0);// Recur for left and right subtreesreturn(isComplete(root->left, 2*index + 1, number_nodes)&& isComplete(root->right, 2*index + 2, number_nodes));}/* Helper function that allocates a new node with the given key and NULL left and right pointer. */struct Node *newNode(char k){struct Node *node =(struct Node*)malloc(sizeof(struct Node)); node->key = k; node->right = node->left = NULL;return node;}/* This function tests if a binary tree is a full binary tree. */int isFullTree (struct Node* root){// If empty treeif(root == NULL)return(1);// If leaf nodeif(root->left == NULL && root->right == NULL)return(1);// If both left and right are not NULL, and left & right subtrees// are fullif((root->left)&&(root->right))return(isFullTree(root->left)&& isFullTree(root->right));// We reach here when none of the above if conditions workreturn(0);}// Driver Programvoid main(){struct Node* root = NULL;unsignedint node_count;unsignedint index; clrscr(); root = newNode(10); root->left = newNode(20); root->right = newNode(30); root->left->right = newNode(40); root->left->left = newNode(50); root->right->left = newNode(60); root->right->right = newNode(70); root->left->left->left = newNode(80); root->left->left->right = newNode(90); root->left->right->left = newNode(80); root->left->right->right = newNode(90); root->right->left->left = newNode(80); root->right->left->right = newNode(90); root->right->right->left = newNode(80); root->right->right->right = newNode(90); node_count = countNodes(root); index =0;if(isComplete(root, index, node_count))printf("\nThe Binary Tree is complete\n");elseprintf("\nThe Binary Tree is not complete\n");if(isFullTree(root))printf("\nThe Binary Tree is full\n");elseprintf("\nThe Binary Tree is not full\n"); getch();
Category: AssignmentsC TheoryTags: 2017, 2017 - 18, 2018, accepts, algorithm, appropriate, Assignment, BCA, Binary, checks, Complete Binary Tree, Full Binary Tree, Ignou, input, MCA, message, prints, program, Tree, Write

MCSL-016
Course Title : Internet Concepts and Web Design
Assignment Number : MCA(1)/016/Assignment/17-18
Maximum Marks : 100
Weightage : 25%
Last Dates for Submission : 15th October, 2017 (For July 2017 Session)
: 15th April, 2018 (For January 2018 Session)
There are two questions in this assignment carrying a total of 40 marks. Your Lab Record
will carry 40 Marks. Rest 20 marks are for viva voce. You may use illustrations and
diagrams to enhance the explanations. Please go through the guidelines regarding
assignments given in the Programme Guide for the format of presentation. Submit the
screenshots along with the coding and documentation.
Question 1 (35Marks)
IGBooks is a publishing company which publishes and sells its books through
a network of resellers. The company has a website that provides the list of
published books and the list of reseller who has the stock of the books. The
books can also be sold online and despatched to the address of registered
buyers. The website provides all the details of the books including authors,
abstract, price, availability etc. Create a web site for this company having the
following features:
For the sake of consistency every page of the website should consists of four
basic divisions –
Top – This division should be of fixed size and should display publisher
name and logo. This division should be in different background
colour. This division should be at the top of every page.
Bottom – This division contains the name of maintenance agency of the
website and copyright information. This division should be at the
bottom of every page.
Info – The pages that you are designing should differ in this Division
only. The five different pages that you need to design are – Home,
Books, Purchase, Status of purchase and Feedback.
Links – This division should be towards the left in every web page and
should contain links to all the five web pages viz. Home, Books,
Purchase, Status of purchase and Feedback.
The Info division of the five different pages should be as under:
• Home page should include Welcome message, the most popular books,
most popular author etc.
• Books page shows the Category-wise list of various Books, their authors,
abstract of the book and price of the book. This list should be displayed
using table.
16
• Purchase page should show a HTML form that should ask for username
and password. You may use JavaScript to verify that username and
password are BCAMCA and TestPwd.
• Status of purchase page should display the list of all the past online orders
that has been received by the publishers. This information should be
displayed for at least two books.
• Feedback page should contain a form which should have fields – name, last
book purchased, contact email, feedback on the book. You must use
JavaScript to check that all the fields are filled by the person giving the
feedback.
MCSL-016 SOLVED ASSIGNMENT 2017-18

Question 2 (5 Marks)
List any two latest web development technologies. List five important features
of each of these technologies.
MCSL-016 SOLVED ASSIGNMENT 2017-18

0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *