Posts

WEB Engineering Lab 1

Task 1:(Login Page) <head> <title>Untitled Document</title> </head> <style> img{                 display:block;                 margin-left:auto;                 margin-right:auto; } p{                 text-align:center; } </style> <body> <img src="login.png" alt="login" width="150" height="150" align="texttop"/> <p> Username: <input type="text" Name="Saad" size="30" /></p> <p> Password: <input type="text" Password="dfd" size="30" /> <br><br> <button> login </button>&nbsp; <button> cancel </button><br> <input type="checkbo...

DBMS LAb 1

Image
Exercise: 1. Get empno,ename,sal,deptno from emp table.  2. Count total number of employees.  3. Get the highest and the lowest salary from emp table.  4. Calculate net salaries of employee (by adding salary and comm).  5. Display all the deptno that employees belong to, but don’t allow repetition.  6. Display data of all employees who work as Salesman.  7. Display names of employees who work in deptno 20.  8. Calculate one year salary of every employee from emp table.  9. Display the total count of departments from dept table.  10. Display the employee name whose salary is more than 2000 but less than 3500.  11. Display all employee names and their manager number from emp table.  12. Show the average salary of all employees.  13. Show the total salary of all employees

Read data from text file and store in doubly linked list

struct node{ int num; node*next=NULL; node*prev=NULL; };node*head=NULL; node*temp=NULL; void start() { int num; bool flag=false; ifstream myfile("file.txt"); while(!myfile.eof()) { myfile>>num; node*c=new node;   c->num= if(head==NULL) { head=c; flag=true; } else { temp=head; { while(temp->next!=NULL) { temp=temp->next; } temp->next=c; c->prev=temp; } } } myfile.close(); }

Telephone Directory Using BST

Source Code: #include <iostream> #include <string> using namespace std; struct phone{  int Num;  int code; string address; string name; phone*right; phone*left; };phone*root=NULL; phone*nodeptr=NULL; //insert void insert(string nme,string add, int phno,int Code) { phone*p=new phone; p->name=nme; p->address=add; p->Num=phno; p->code=Code; p->right=NULL; p->left=NULL; if(root==NULL) { root=p; cout<<"PHone nUmber is saved \n"; } else {       nodeptr=root; while(nodeptr!=NULL) { if(phno<nodeptr->Num) { if(nodeptr->left!=NULL) { nodeptr=nodeptr->left; } else { nodeptr->left=p; cout<<"PHone nUmber is saved \n"; break; } } else if(phno>nodeptr->Num) { if(nodeptr->right!=NULL) { nodeptr=nodeptr->ri...

Data Structure LAb 10

Source Code: #include <iostream> using namespace std; struct tree { int num; tree*left=NULL; tree*right=NULL; };tree*root=NULL; tree*nodeptr=NULL; //add tree void add(int n) { tree* t=new tree; t->num=n; t->left=NULL; t->right=NULL; bool flag=false; if(root==NULL) { root=t; flag=true; } else { nodeptr=root; while(nodeptr!=NULL) { if(n<nodeptr->num) { if(nodeptr->left!=NULL) { nodeptr=nodeptr->left; } else { nodeptr->left=t; flag=true; break; } } else if(n>nodeptr->num) { if(nodeptr->right!=NULL) { nodeptr=nodeptr->right; } else { flag=true; nodeptr->right=t; break; } } else { cout<<"Duplicate NUmber \n"; break; } } } if(flag==true) cout<<"Va...

Circular Linked List

Source code: #include <iostream> using namespace std; struct node{ int num; node*next; };node*head=NULL; node*temp=NULL; void add(int n) { bool flag=false; node*newnode=new node; newnode->num=n; if(head==NULL) { head=newnode; newnode->next=head; flag=true; } else { temp=head; while(temp->next!=head) { temp=temp->next; } temp->next=newnode; newnode->next=head; flag=true; } if(flag==true) cout<<"value is entered \n"; else cout<<"Error \n"; } void Delete() { bool flag=false; node*temp2=NULL; if(head==NULL) { cout<<"list is empty \n"; } else if(head->next==head) { head->next=NULL; head=NULL; delete head; flag=true; } else { temp=head; while(temp->next!=head) { temp2=temp; temp=temp->next; } temp2->next=head; delete temp; flag=true; } if(flag==true) cout<<"value is Deleted \n"; else cout<<"E...

Data Structure Theory Assignment 2

Question#1 a)       What are the advantages of doubly linked list over singly linked list? Advantages over singly linked list 1) A DLL can be traversed in both forward and backward direction. 2) The delete operation in DLL is more efficient if pointer to the node to be deleted is given. In singly linked list, to delete a node, pointer to the previous node is needed. To get this  previous node, sometimes the list is traversed. In DLL, we can get the previous node using previous pointer. a)       What’s the difference between singly, doubly and circular linked list? Singly linked list A singly linked list is a linked list where the node contains some data and a pointer to the next node in the list It allows traversal only in one way It uses less memory per node (single pointer) Doubly A doubly linked list is complex type of linked list where the node contains some data and a pointer to the next as well as the...