AIM:- To write a C program to create a singly linked list implementation.

Size: px
Start display at page:

Download "AIM:- To write a C program to create a singly linked list implementation."

Transcription

1 SINGLY LINKED LIST AIM:- To write a C program to create a singly linked list implementation. ALGORITHM:- 1. Start the program. 2. Get the choice from the user. 3. If the choice is to add records, get the data from the user and add them to the list. 4. If the choice is to delete records, get the data to be deleted and delete it from the list. 5. If the choice is to display number of records, count the items in the list and display. 6. If the choice is to search for an item, get the item to be searched and respond yes if the item is found, otherwise no. 7. Terminate the program PROGRAM: # include<stdio.h> # include<conio.h> # include<stdlib.h> int pos,pos1,i; struct list int no; struct list *next; *q,*temp,*head; void insert(); void del(); void display(); void exit(); void main() int choice; clrscr(); head=(struct list*)malloc(sizeof(struct list)); head->next=null; while(1) printf("\n 1.insert\n2.delete\n3.list all\n 4.exit"); printf("\nenter the choice:"); scanf("%d",&choice);

2 switch(choice) case 1: insert(); case 2: del(); case 3: display(); default: exit(0); void insert() int ch; temp = (struct list*) malloc(sizeof(struct list)); printf("\n enter the element:"); scanf("%d",&temp->no); head->next=temp; temp->next=null; printf("\n Enter the position u want to insert:"); printf("\n1.first\n2.middle\n3.end\n--->"); scanf("%d",&ch); switch(ch) case 1: temp->next=head->next; head->next=temp; case 2: printf("\n Enter the position:"); scanf("%d",&pos); for(i=1;i<pos-1;i++)

3 temp->next=q->next; q->next=temp; case 3: while(q->next!=null) q->next=temp; temp->next=null; void del() printf("\nlist is empty"); printf("\n Enter the position u want to delete:"); scanf("%d",&pos1); if(pos1==1) head->next=q->next; for(i=1;i<pos1-1;i++) q->next=q->next->next; void display() printf("\nlist is empty");

4 printf("\n the elements present in the list are:\n"); while(q!=null) printf("%d->",q->no); getch(); OUTPUT: RESULT: Thus the c program for creating singly linked list is implemented, executed, tested and verified successfully. DOUBLY LINKED LIST AIM:- To write a C program to implement a doubly linked list. ALGORITHM:- 1. Start the program. 2. Get the choice from the user. 3. If the choice is to add records, get the data from the user and add them to the list. 4. If the choice is to delete records, get the data to be deleted and delete it from the list. 5. If the choice is to display number of records, count the items in the list and display. 6. If the choice is to search for an item, get the item to be searched and respond yes if the item is found, otherwise no. 7. Terminate the program PROGRAM:

5 # include<stdio.h> # include<conio.h> # include<stdlib.h> int pos,pos1,i; struct list int no; struct list *prev,*next; *p,*q,*temp,*head; void insert(); void del(); void display(); void exit(); void main() int choice; clrscr(); head=(struct list*)malloc(sizeof(struct list)); head->next=null; while(1) printf("\n 1.insert\n2.delete\n3.list all\n 4.exit"); printf("\nenter the choice:"); scanf("%d",&choice); switch(choice) case 1: insert(); case 2: del(); case 3: display(); default: exit(0); void insert()

6 int ch; temp = (struct list*) malloc(sizeof(struct list)); printf("\n enter the element:"); scanf("%d",&temp->no); head->next=temp; temp->prev=head; temp->next=null; printf("\n Enter the position u want to insert:"); printf("\n1.first\n2.middle\n3.end\n--->"); scanf("%d",&ch); switch(ch) case 1: temp->next=q; q->prev=temp; head->next=temp; temp->prev=head; case 2: printf("\n Enter the position:"); scanf("%d",&pos); for(i=1;i<pos-1;i++) p=q->next; temp->next=p; p->prev=temp; q->next=temp; temp->prev=q; case 3: while(q->next!=null) q->next=temp; temp->prev=q; temp->next=null;

7 void del() printf("\nlist is empty"); printf("\n Enter the position u want to delete:"); scanf("%d",&pos1); if(pos1==1) head->next=q->next; q->prev=head; for(i=1;i<pos1-1;i++) p=q->next; q->next=p->next; p->prev=q; void display() printf("\nlist is empty"); printf("\n the elements present in the list are:\n"); while(q!=null) printf("%d->",q->no); getch();

8 OUTPUT: RESULT: Thus the c program for creating Doubly linked list is implemented, executed, tested and verified successfully.

9

POLYNOMIAL ADDITION. AIM:- To write a C program to represent a polynomial as a linked list and write functions for polynomial addition.

POLYNOMIAL ADDITION. AIM:- To write a C program to represent a polynomial as a linked list and write functions for polynomial addition. POLYNOMIAL ADDITION AIM:- To write a C program to represent a polynomial as a linked list and write functions for polynomial addition. ALGORITHM:- 1. Start the program 2. Get the coefficients and powers

More information

DS Lab Manual -17CS33

DS Lab Manual -17CS33 Chethan Raj C Assistant Professor Dept. of CSE 6. Design, Develop and Implement a menu driven Program in C for the following operations on Circular QUEUE of Characters (Array Implementation of Queue with

More information

Linked List in Data Structure. By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra

Linked List in Data Structure. By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra Linked List in Data Structure By Prof. B J Gorad, BECSE, M.Tech CST, PHD(CSE)* Assistant Professor, CSE, SITCOE, Ichalkaranji,Kolhapur, Maharashtra Linked List Like arrays, Linked List is a linear data

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 18 EXAMINATION Subject Name: Data Structure using C Model wer Subject Code: 22317 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given

More information

Data accessing is faster because we just need to specify the array name and the index of the element to be accssed.. ie arrays are simple to use

Data accessing is faster because we just need to specify the array name and the index of the element to be accssed.. ie arrays are simple to use Module 3 Linear data structures and linked storage representation Advantages of arrays Linear data structures such as stacks and queues can be represented and implemented using sequential allocation ie

More information

Module III. Linear Data Structures and their Linked Storage Representation

Module III. Linear Data Structures and their Linked Storage Representation Module III Linear Data Structures and their Linked Storage Representation 3.1 Linked List Linked list is the collection of inter connected nodes with a head node representing the first node and a tail

More information

DEV BHOOMI INSTITUTE OF TECHNOLOGY

DEV BHOOMI INSTITUTE OF TECHNOLOGY DEV BHOOMI INSTITUTE OF TECHNOLOGY Department of Computer Science and Engineering Year: 2nd Semester: 3rd Data Structures- PCS-303 LAB MANUAL Prepared By: HOD(CSE) DEV BHOOMI

More information

/* Polynomial Expressions Using Linked List*/ #include<stdio.h> #include<conio.h> #include <malloc.h> struct node. int num; int coeff;

/* Polynomial Expressions Using Linked List*/ #include<stdio.h> #include<conio.h> #include <malloc.h> struct node. int num; int coeff; /* Polynomial Expressions Using Linked List*/ #include #include #include struct node int num; int coeff; struct node *next; ; struct node *start1 = NULL; struct node *start2

More information

/*Addition of two polynomials*/ #include<stdio.h> #include<malloc.h> #include<conio.h> struct link { int coeff; int pow; struct link *next; }; struct

/*Addition of two polynomials*/ #include<stdio.h> #include<malloc.h> #include<conio.h> struct link { int coeff; int pow; struct link *next; }; struct /*Addition of two polynomials*/ #include #include #include struct link int coeff; int pow; struct link *next; ; struct link *poly1=null,*poly2=null,*poly=null; void create(struct

More information

Data Structures and Applications (17CS33)

Data Structures and Applications (17CS33) 3.7 Reversing a Singly Linked List #include #include struct node int data; struct node *next; ; void insert_list(int); void display(); void revers(); struct node *head,*newnode,*tail,*temp,*temp1,*temp2;

More information

Single linked list. Program: #include<stdio.h> #include<conio.h> #include<alloc.h> struct node. int info; struct node *next; void main()

Single linked list. Program: #include<stdio.h> #include<conio.h> #include<alloc.h> struct node. int info; struct node *next; void main() Single linked list Program: #include #include #include struct node int info; struct node *next; ; void main() struct node *s,*start,*prev,*new1,*temp,*temp1,*ptemp; int cho,i,j,x,n,p;

More information

Information Technology Association Department of Information Technology MIT Campus, Anna University Chennai

Information Technology Association Department of Information Technology MIT Campus, Anna University Chennai Algorithm Puzzles - Week1 Solutions 1. Swap two integer variables without using temporary variable. Give at least two different solutions. The first solution is a=a+b; b=a-b; a=a-b; Hope most of you are

More information

Solution for Data Structure

Solution for Data Structure Solution for Data Structure May 2016 INDEX Q1 a 2-3 b 4 c. 4-6 d 7 Q2- a 8-12 b 12-14 Q3 a 15-18 b 18-22 Q4- a 22-35 B..N.A Q5 a 36-38 b N.A Q6- a 39-42 b 43 1 www.brainheaters.in Q1) Ans: (a) Define ADT

More information

UNIT VI. STACKS AND QUEUES

UNIT VI. STACKS AND QUEUES UNIT VI. STACKS AND QUEUES Syllabus: /*-------------------------------------------------------------------------*/ Stack: Definition: "Stack is an ordered collection of data elements having similar data

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 16 EXAMINATION Model Answer Subject Code:

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 16 EXAMINATION Model Answer Subject Code: Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model answer and the answer written by candidate

More information

LINKED LIST IMPLEMENTATION USING C LANGUAGE: A REVIEW

LINKED LIST IMPLEMENTATION USING C LANGUAGE: A REVIEW LINKED LIST IMPLEMENTATION USING C LANGUAGE: A REVIEW Ekta Nehra Assistant Professor (Extn.), C.R.M jat college, Hisar, Haryana, (India) ABSTRACT This paper describes about linear data structure i.e. linked

More information

Answer to Problem Set 2 Out: 15 September, 1995

Answer to Problem Set 2 Out: 15 September, 1995 Burt Rosenberg Math 220/317: Programming II/Data Structures 1 Answer to Problem Set 2 Out: 15 September, 1995 /* * Answer to Problem Set 2 * Univ. of Miami, Math 220/317 * Fall 1995 * Prof. B. Rosenberg

More information

Application of Stack (Backtracking)

Application of Stack (Backtracking) Application of Stack (Backtracking) Think of a labyrinth or maze How do you find a way from an entrance to an exit? Once you reach a dead end, you must backtrack. But backtrack to where? to the previous

More information

STACKS 3.1 INTRODUCTION 3.2 DEFINITION

STACKS 3.1 INTRODUCTION 3.2 DEFINITION STACKS 3 3.1 INTRODUCTION A stack is a linear data structure. It is very useful in many applications of computer science. It is a list in which all insertions and deletions are made at one end, called

More information

//2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING. #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<stdlib.

//2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING. #include<stdio.h> #include<conio.h> #include<graphics.h> #include<math.h> #include<stdlib. //2D TRANSFORMATION TRANSLATION, ROTATING AND SCALING #include #include #include #include #include void main() int gd=detect,gm,i,x[10],y[10],a,b,c,d,n,tx,ty,sx,sy,ch;

More information

Linked Lists and other Dynamic Data Structures

Linked Lists and other Dynamic Data Structures Linked Lists and other Dynamic Data Structures Arrays Fixed in size Allocated in advance within a contiguous memory block Look-up is fast Resizing and Deleting is hard (reallocate and copy) Dynamic Data

More information

Case Control Structure. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan

Case Control Structure. Rab Nawaz Jadoon DCS. Assistant Professor. Department of Computer Science. COMSATS IIT, Abbottabad Pakistan Case Control Structure DCS COMSATS Institute of Information Technology Rab Nawaz Jadoon Assistant Professor COMSATS IIT, Abbottabad Pakistan Introduction to Computer Programming (ICP) Decision control

More information

Downloaded from : Algorithm: Implementation QUESTION 1 :

Downloaded from :   Algorithm: Implementation QUESTION 1 : QUESTION 1 : WRITE AN ALGORITHM THAT ACCEPTS A BINARY TREE AS INPUT AND PR INTS ITS HEIGHT TO STANDARD OUTPUT. Algorithm: 1. If tree is empty then return 0 2. Else (a) Get the max depth of left subtree

More information

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer.

It is necessary to have a single function main in every C program, along with other functions used/defined by the programmer. Functions A number of statements grouped into a single logical unit are called a function. The use of function makes programming easier since repeated statements can be grouped into functions. Splitting

More information

Keywords queue, left sub list, right sub list, output array list, output linked list, input array list, divide list, sort, combine

Keywords queue, left sub list, right sub list, output array list, output linked list, input array list, divide list, sort, combine Volume 4, Issue 12, December 2014 ISSN: 2277 128X International Journal of Advanced Research in Computer Science and Software Engineering Research Paper Available online at: www.ijarcsse.com Divide and

More information

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA USN 1 P E PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of MCA INTERNAL ASSESSMENT TEST 2 (Scheme and Solution) Data Structures Using C (16MCA11) 1) A.

More information

SINGLE LINKED LIST. Algorithm for allocating memory for the new node

SINGLE LINKED LIST. Algorithm for allocating memory for the new node SRI CHANDRASEKHARENDRA SARASWATHI VISWA MAHAVIDYALAYA SCSVMV UNIVERSITY DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Faculty: S.Gokulakrishnan AP/CSE SINGLE LINKED LIST Aim:- Write a C program to implement

More information

Frequently asked Data Structures Interview Questions

Frequently asked Data Structures Interview Questions Frequently asked Data Structures Interview Questions Queues Data Structure Interview Questions How is queue different from a stack? The difference between stacks and queues is in removing. In a stack we

More information

The combination of pointers, structs, and dynamic memory allocation allow for creation of data structures

The combination of pointers, structs, and dynamic memory allocation allow for creation of data structures Data Structures in C C Programming and Software Tools N.C. State Department of Computer Science Data Structures in C The combination of pointers, structs, and dynamic memory allocation allow for creation

More information

/****************************************** Application: Linked List Example Compiled on: Borland Turbo C++ 3.0

/****************************************** Application: Linked List Example Compiled on: Borland Turbo C++ 3.0 /****************************************** Application: Linked List Example Compiled on: Borland Turbo C++ 3.0 ******************************************/ #include #include /* Structure

More information

INSERT AS A FIRST NODE

INSERT AS A FIRST NODE CIRCULAR LINKED LIST Insert as a first node Insert as a last node Delete first node Delete last node Insert after a node Insert before a node Search Traverse INSERT AS A FIRST NODE void insertf() struct

More information

UNIT 4: Linked List Programs demonstrated in class. Tojo Mathew Asst. Professor CSE Dept., NIE Mysuru.

UNIT 4: Linked List Programs demonstrated in class. Tojo Mathew Asst. Professor CSE Dept., NIE Mysuru. UNIT 4: Linked List Programs demonstrated in class. Tojo Mathew Asst. Professor CSE Dept., NIE Mysuru. 1 Table of Contents 1. Array Implementation of Linked List...3 2. Queue using Array Implementation

More information

PESIT Bangalore South Campus

PESIT Bangalore South Campus TEST - 2 Date : 29-9-2014 Marks : 50 Subject & Code : DS(10CS35) Class : III CSE &ISE Name of faculty : Dr.JSP/Mrs.Vandana/Mrs.Renuka Time : 11.30AM to 1 PM Note: Answer any 5 Questions 1 Write a C program

More information

MODULE 1. Introduction to Data Structures

MODULE 1. Introduction to Data Structures MODULE 1 Introduction to Data Structures Data Structure is a way of collecting and organizing data in such a way that we can perform operations on these data in an effective way. Data Structures is about

More information

MC9217 / Programming and Data Structures Lab MC9217 PROGRAMMING AND DATA STRUCTURES LAB L T P C

MC9217 / Programming and Data Structures Lab MC9217 PROGRAMMING AND DATA STRUCTURES LAB L T P C MC9217 PROGRAMMING AND DATA STRUCTURES LAB L T P C 0 0 3 2 1.Create a Stack and do the following operations using arrays and linked lists (i)push (ii) Pop (iii) Peep 2.Create a Queue and do the following

More information

This can be formulated into a hypergeometric distribution of the following formula: ) (N = ( 45! 255! 500!

This can be formulated into a hypergeometric distribution of the following formula: ) (N = ( 45! 255! 500! Given a population of N = 500 with A = 200 successes, a sample of n = 100 is taken, we would like to find the probability of any ratio of success within the smaller sample, say 55%. This can be formulated

More information

DATA STRUCTURE ASSIGNMENT

DATA STRUCTURE ASSIGNMENT PROGRAM TO SEARCH AN ITEM FROM AN ARRAY USING BINARY SEARCH: CODE:- #include #include int main() int a[100],n,start,end,mid,i,s,j,swap; printf("enter the Number of Terms: "); scanf("%d",&n);

More information

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0)

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0) CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-0-0) Class Teacher: Pralay Mitra Department of Computer Science and Engineering Indian Institute of Technology Kharagpur Conceptual Idea

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 17 EXAMINATION Subject Name: Data Structure Using C Model Answer Subject Code: 17330 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as

More information

Sree Vidyanikethan Engineering College Sree Sainath Nagar, A. Rangampet

Sree Vidyanikethan Engineering College Sree Sainath Nagar, A. Rangampet Sree Vidyanikethan Engineering College Sree Sainath Nagar, A. Rangampet 517 102 Department of Computer Science and Engineering I B. Tech C Programming Language Lab Title: Stack SVEC/IT/EXPT-CP-21 PROBLEM

More information

Problem # 1. calculate the grade. Allow a student the next grade if he/she needs only 0.5 marks to obtain the next grade. Use else-if construction.

Problem # 1. calculate the grade. Allow a student the next grade if he/she needs only 0.5 marks to obtain the next grade. Use else-if construction. ME 172 Lecture 6 Problem # 1 Write a program to calculate the grade point average of a 3.00 credit hour course using the data obtained from the user. Data contains four items: attendance (30), class test

More information

What is recursion. WAP to find sum of n natural numbers using recursion (5)

What is recursion. WAP to find sum of n natural numbers using recursion (5) DEC 2014 Q1 a What is recursion. WAP to find sum of n natural numbers using recursion (5) Recursion is a phenomenon in which a function calls itself. A function which calls itself is called recursive function.

More information

DATA STRUCTURES LAB MANUAL

DATA STRUCTURES LAB MANUAL DATA STRUCTURES LAB MANUAL Year : 2016-2017 Course Code : ACS102 Regulations : R16 Semester : I B.Tech II Semester Branch : CSE / IT Prepared by Ms. N. JAYANTHI ASSOCIATE PROFESSOR INSTITUTE OF AERONAUTICAL

More information

Pointers. Mr. Ovass Shafi (Assistant Professor) Department of Computer Applications

Pointers. Mr. Ovass Shafi (Assistant Professor) Department of Computer Applications Pointers Introduction: A variable is a named memory location that holds some value. Each variable has some address associated with it. Till now we only worked on the values stored in the variables and

More information

Arrays in C. By Mrs. Manisha Kuveskar.

Arrays in C. By Mrs. Manisha Kuveskar. Arrays in C By Mrs. Manisha Kuveskar. C Programming Arrays An array is a collection of data that holds fixed number of values of same type. For example: if you want to store marks of 100 students, you

More information

The time and space are the two measure for efficiency of an algorithm.

The time and space are the two measure for efficiency of an algorithm. There are basically six operations: 5. Sorting: Arranging the elements of list in an order (either ascending or descending). 6. Merging: combining the two list into one list. Algorithm: The time and space

More information

Prepared By:- Dinesh Sharma Asstt. Professor, CSE & IT Deptt. ITM Gurgaon

Prepared By:- Dinesh Sharma Asstt. Professor, CSE & IT Deptt. ITM Gurgaon Data Structures &Al Algorithms Prepared By:- Dinesh Sharma Asstt. Professor, CSE & IT Deptt. ITM Gurgaon What is Data Structure Data Structure is a logical relationship existing between individual elements

More information

Fundamentals of Programming & Procedural Programming

Fundamentals of Programming & Procedural Programming Universität Duisburg-Essen PRACTICAL TRAINING TO THE LECTURE Fundamentals of Programming & Procedural Programming Session Eight: Math Functions, Linked Lists, and Binary Trees Name: First Name: Tutor:

More information

Now consider the following situation after deleting three elements from the queue...

Now consider the following situation after deleting three elements from the queue... Scheme of valuvation -1I Subject & Code : Data Structure and Application (15CS33) NOTE: ANSWER All FIVE QUESTIONS 1 Explain the diadvantage of linear queue and how it i olved in circular queue. Explain

More information

DC104 DATA STRUCTURE JUNE Q.2 a. If you are using C language to implement the heterogeneous linked list, what pointer type will you use?

DC104 DATA STRUCTURE JUNE Q.2 a. If you are using C language to implement the heterogeneous linked list, what pointer type will you use? Q.2 a. If you are using C language to implement the heterogeneous linked list, what pointer type will you use? The heterogeneous linked list contains different data types in its nodes and we need a link

More information

Dynamic Memory Allocation

Dynamic Memory Allocation Dynamic Memory Allocation The process of allocating memory at run time is known as dynamic memory allocation. C does not Inherently have this facility, there are four library routines known as memory management

More information

Methodology and Program. By Abhishek Navlakhi Semester 3: Data Structures

Methodology and Program. By Abhishek Navlakhi Semester 3: Data Structures Linked List Methodology and Program By Abhishek Navlakhi Semester 3: Data Structures This document is for private circulation for the students of Navlakhi. More educational content can be found on www.navlakhi.com

More information

Model Solution for QP CODE : ( 3 Hours )

Model Solution for QP CODE : ( 3 Hours ) Model Solution for QP CODE : 24788 ( 3 Hours ) All answers are for reference only. Any alternate answer that solves the problem should be considered eqully valid. 1. (a) Define data structure? Give its

More information

TERM PAPER ON HOSPITAL MANAGEMENT SYSTEM

TERM PAPER ON HOSPITAL MANAGEMENT SYSTEM TERM PAPER ON HOSPITAL MANAGEMENT SYSTEM Acknowledgment This project is a welcome and challenging experience for us as it took a great deal of hard work and dedication for its successful completion. It

More information

Government Girls Polytechnic, Bilaspur

Government Girls Polytechnic, Bilaspur Government Girls Polytechnic, Bilaspur Name of the Lab: Programming Lab Practical: Data Structure Lab Class: 4 th Semester (Computer Science & Engineering) Teachers Assessment: 30 End Semester Examination:70

More information

Subject: Fundamental of Computer Programming 2068

Subject: Fundamental of Computer Programming 2068 Subject: Fundamental of Computer Programming 2068 1 Write an algorithm and flowchart to determine whether a given integer is odd or even and explain it. Algorithm Step 1: Start Step 2: Read a Step 3: Find

More information

Computers Programming Course 12. Iulian Năstac

Computers Programming Course 12. Iulian Năstac Computers Programming Course 12 Iulian Năstac Recap from previous course Strings in C The character string is one of the most widely used applications that involves vectors. A string in C is an array of

More information

Merge Sort and Analysis --- Analyzing Recursive Programs. Why are we dealing with merge sort in this course?

Merge Sort and Analysis --- Analyzing Recursive Programs. Why are we dealing with merge sort in this course? Merge Sort and Analysis --- Analyzing Recursive Programs Debdeep Mukhopadhyay IIT Kharagpur Why are we dealing with merge sort in this course? It is a powerful application of Divide and Conquer technique

More information

/*Tree Traversals*/ #include<stdio.h> #include<conio.h> typedef struct bin { int data; struct bin *left,*right; }node;

/*Tree Traversals*/ #include<stdio.h> #include<conio.h> typedef struct bin { int data; struct bin *left,*right; }node; /*Tree Traversals*/ #include #include typedef struct bin int data; struct bin *left,*right; node; void insert(node *,node *); void inorder(node *); void preorder(node *); void postorder(node

More information

BITS PILANI, DUBAI CAMPUS DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI FIRST SEMESTER

BITS PILANI, DUBAI CAMPUS DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI FIRST SEMESTER BITS PILANI, DUBAI CAMPUS DUBAI INTERNATIONAL ACADEMIC CITY, DUBAI FIRST SEMESTER 2017-2018 COURSE : COMPUTER PROGRAMMING (CS F111) COMPONENT : Tutorial# 7 (SOLUTIONS) DATE : 06-DEC-2017 Answer 1 enum

More information

DC54 DATA STRUCTURES JUNE 2013

DC54 DATA STRUCTURES JUNE 2013 Q 2 (a) Define storage class and its functions. Explain in detail scope, storage allocation and purpose of each storage class. 'Storage' refers to the scope of a variable and memory allocated by compiler

More information

Q2: Write an algorithm to merge two sorted arrays into a third array? (10 Marks) Ans Q4:

Q2: Write an algorithm to merge two sorted arrays into a third array? (10 Marks) Ans Q4: Model Answer Benha University 1 st Term (2013/2014) Final Exam Class: 2 nd Year Students Subject: Data Structures Faculty of Computers & Informatics Date: 26/12/2013 Time: 3 hours Examiner: Dr. Essam Halim

More information

Computer Systems and Networks

Computer Systems and Networks University of the Pacific LECTURE 5: C PROGRAMMING Computer Systems and Networks Dr. Pallipuram (vpallipuramkrishnamani@pacific.edu) Today s Class o Pointer basics o Pointers and mul;- dimensional arrays

More information

DEPARTMENT OF COMPUTER SCEINCE AND ENGINEERING DATA STRUCTURES LABORATORY. Subject Code: 17CSL38. B.E - III Semester. Academic Year:

DEPARTMENT OF COMPUTER SCEINCE AND ENGINEERING DATA STRUCTURES LABORATORY. Subject Code: 17CSL38. B.E - III Semester. Academic Year: Channabasaveshwara Institute of Technology (Affiliated to VTU, Belgaum & Approved by AICTE, New Delhi) (NAAC Accredited & ISO 9001:2015 Certified Institution) NH 206 (B.H. Road), Gubbi, Tumkur 572 216.

More information

CS32 Discussion Week 3

CS32 Discussion Week 3 CS32 Discussion Week 3 Muhao Chen muhaochen@ucla.edu http://yellowstone.cs.ucla.edu/~muhao/ 1 Outline Doubly Linked List Sorted Linked List Reverse a Linked List 2 Doubly Linked List A linked list where

More information

SELECTION STATEMENTS:

SELECTION STATEMENTS: UNIT-2 STATEMENTS A statement is a part of your program that can be executed. That is, a statement specifies an action. Statements generally contain expressions and end with a semicolon. Statements that

More information

Dev Bhoomi Institute Of Technology. Department of Computer Application EXPERIMENT NO. ISSUE NO. : ISSUE DATE: REV. NO. : REV.

Dev Bhoomi Institute Of Technology. Department of Computer Application EXPERIMENT NO. ISSUE NO. : ISSUE DATE: REV. NO. : REV. LIST OF PRACTICALS 1. Matrix Operations-Add and Multiply 2. String Operations strlen(), strcat() etc. 3. Stack operations using Arrays. 4. Implementing Polish Notations using Stacks. 5. Evaluating postfix

More information

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE

PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE PROGRAMMING IN C LAB MANUAL FOR DIPLOMA IN ECE/EEE 1. Write a C program to perform addition, subtraction, multiplication and division of two numbers. # include # include int a, b,sum,

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in themodel answer scheme. 2) The model answer and the answer written by candidate may

More information

Procedural Programming

Procedural Programming Exercise 6 (SS 2016) 04.07.2015 What will I learn in the 6. exercise Math functions Dynamic data structures (linked Lists) Exercise(s) 1 Home exercise 4 (3 points) Write a program which is able to handle

More information

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields:

Assignment 6. Q1. Create a database of students using structures, where in each entry of the database will have the following fields: Assignment 6 Q1. Create a database of students using structures, where in each entry of the database will have the following fields: 1. a name, which is a string with at most 128 characters 2. their marks

More information

MTH 307/417/515 Final Exam Solutions

MTH 307/417/515 Final Exam Solutions MTH 307/417/515 Final Exam Solutions 1. Write the output for the following programs. Explain the reasoning behind your answer. (a) #include int main() int n; for(n = 7; n!= 0; n--) printf("n =

More information

Data Structure (MCA) Nitasha Jain Assistant Professor Department of IT Biyani Girls College, Jaipur

Data Structure (MCA) Nitasha Jain Assistant Professor Department of IT Biyani Girls College, Jaipur Biyani's Think Tank Concept based notes Data Structure (MCA) Nitasha Jain Assistant Professor Department of IT Biyani Girls College, Jaipur 2 Published by : Think Tanks Biyani Group of Colleges Concept

More information

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) WINTER 18 EXAMINATION Subject Name: Data Structure Model wer Subject Code: 17330 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in

More information

Module III. Linear Data Structures and their Linked Storage Representation

Module III. Linear Data Structures and their Linked Storage Representation Module III Linear Data Structures and their Linked Storage Representation 3.1 Linked List Linked list is the collection of inter connected nodes with a head node representing the first node and a tail

More information

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I

SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I SRI VIDYA COLLEGE OF ENGINEERING & TECHNOLOGY, VIRUDHUNAGAR Department of CSE & IT Internal Test I Year & Sem: I B.E (CSE) & II Date of Exam: 21/02/2015 Subject Code & Name: CS6202 & Programming & Data

More information

Unit 8. Structures and Unions. School of Science and Technology INTRODUCTION

Unit 8. Structures and Unions. School of Science and Technology INTRODUCTION INTRODUCTION Structures and Unions Unit 8 In the previous unit 7 we have studied about C functions and their declarations, definitions, initializations. Also we have learned importance of local and global

More information

Doubly Linked List Methodology and Program

Doubly Linked List Methodology and Program Doubly Linked List Methodology and Program Semester 3: Data Structures This document is for private circulation for the students of Navlakhi. More educational content can be found on www.navlakhi.com and

More information

Procedure Aim: To implement operations on binary heap. BINARY HEAP A binary heap is a complete binary tree which satisfies the heap ordering property.

Procedure Aim: To implement operations on binary heap. BINARY HEAP A binary heap is a complete binary tree which satisfies the heap ordering property. Laboratory 4 BINARY HEAP A binary heap is a complete binary tree which satisfies the heap ordering property. Objective A binary heap is a complete binary tree which satisfies the heap ordering property.

More information

Programming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring

Programming and Data Structures Mid-Semester - Solutions to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring Programming and Data Structures Mid-Semester - s to Sample Questions Dept. of Computer Science and Engg. IIT Kharagpur Spring 2015-16 February 15, 2016 1. Tick the correct options. (a) Consider the following

More information

Lab 10: Disk Scheduling Algorithms

Lab 10: Disk Scheduling Algorithms 1. Objective Lab 10: Disk Scheduling Algorithms Understand Disk Scheduling Algorithm and read its code for SSTF, SCAN, CSCAN in C, 2. Syllabus try to write other kinds of disk scheduling algorithms such

More information

Class / Sem: I CSE / II Semester Subject Code: CS 6202 Subject: Programming and Data Structures I Prepared by T. Vithya Unit IV - LINEAR DATA STRUCTURES STACKS AND QUEUES Stack ADT Evaluating arithmetic

More information

Basically queue is nothing but an array or a vector with a maximum capacity of size. Front=1 Front=1 REAR=2. Front=1 REAR=3 Front=1 REAR=4 Q is Full

Basically queue is nothing but an array or a vector with a maximum capacity of size. Front=1 Front=1 REAR=2. Front=1 REAR=3 Front=1 REAR=4 Q is Full Queue A Queue is defined as linear list in which insertion is taking place at one end and deletion is taking place at the other end. The end where insertion is taking place is called as rear end. The end

More information

Guide for The C Programming Language Chapter 5

Guide for The C Programming Language Chapter 5 1. Differentiate between primitive data type and non-primitive data type. Primitive data types are the basic data types. These data types are used to represent single values. For example: Character, Integer,

More information

CSE2301. Dynamic memory Allocation. malloc() Dynamic Memory Allocation and Structs

CSE2301. Dynamic memory Allocation. malloc() Dynamic Memory Allocation and Structs Warning: These notes are not complete, it is a Skelton that will be modified/add-to in the class. If you want to us them for studying, either attend the class or get the completed notes from someone who

More information

ESc101: (Linear, Circular, Doubly) Linked Lists, Stacks, Queues, Trees. Introduction to Linked Lists

ESc101: (Linear, Circular, Doubly) Linked Lists, Stacks, Queues, Trees. Introduction to Linked Lists ESc101: (Linear, Circular, Doubly) Linked Lists, Stacks, Queues, Trees Instructor: Krithika Venkataramani Semester 2, 2011-2012 1 Introduction to Linked Lists Each bead connected to the next through a

More information

APPENDIX. A.1 Evaluation of thermodynamic property values for the gases. constant pressure, specific enthalpy and specific entropy of various

APPENDIX. A.1 Evaluation of thermodynamic property values for the gases. constant pressure, specific enthalpy and specific entropy of various 223 APPENDIX A.1 Evaluation of thermodynamic property values for the gases comprising C-H-O-N System The following equations are used to calculate specific heat at constant pressure, specific enthalpy

More information

A pointer is a variable just like other variable. The only difference from other variables is that it stores the memory address other variables.

A pointer is a variable just like other variable. The only difference from other variables is that it stores the memory address other variables. Lecture 9 Pointers A pointer is a variable just like other variable. The only difference from other variables is that it stores the memory address other variables. This variable may be of type int, char,

More information

DATA STRUCTURE. 1. malloc() 2. calloc()

DATA STRUCTURE. 1. malloc() 2. calloc() Question : Explain the Dynamic Memory Allocation and following function. When we declare an array in out program, the compiler allocates memory to hold the array prior to providing it. Some times it is

More information

Prepared by: Shraddha Modi

Prepared by: Shraddha Modi Prepared by: Shraddha Modi Introduction In looping, a sequence of statements are executed until some conditions for termination of the loop are satisfied. A program loop consist of two segments Body of

More information

NCS 301 DATA STRUCTURE USING C

NCS 301 DATA STRUCTURE USING C NCS 301 DATA STRUCTURE USING C Unit-1 Part-4 Linked Lists Hammad Mashkoor Lari Assistant Professor Allenhouse Institute of Technology www.ncs301ds.wordpress.com Introduction List refers to linear collection

More information

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-1-0)

CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-1-0) CS11001/CS11002 Programming and Data Structures (PDS) (Theory: 3-1-0) The queue ADT A queue is like a "natural" queue of elements. It is an ordered list in which all insertions occur at one end called

More information

HIGHER SCEONDARY FIRST YEAR PRACTICAL EXAM 2018 COMPUTER SCIENCE SECTION A ( WINDOWS XP )

HIGHER SCEONDARY FIRST YEAR PRACTICAL EXAM 2018 COMPUTER SCIENCE SECTION A ( WINDOWS XP ) HIGHER SCEONDARY FIRST YEAR PRACTICAL EXAM 2018 COMPUTER SCIENCE SECTION A ( WINDOWS XP ) 1.Write the steps to do the Following: a) Enter in to WordPad b) Enter 3 lines with suitable Heading c) Save the

More information

MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified)

MAHARASHTRASTATE BOARD OF TECHNICAL EDUCATION (Autonomous) (ISO/IEC Certified) Subject Code: 17330 Model Answer Page 1/ 22 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The model

More information

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Stamp / Signature of the Invigilator EXAMINATION ( End Semester ) SEMESTER ( Spring ) Roll Number Section Name Subject Number C S 1 0 0 0 1 Subject Name Programming

More information

UNIT 3: QUEUE Programs demonstrated in class. Tojo Mathew Asst. Professor CSE Dept., NIE Mysuru.

UNIT 3: QUEUE Programs demonstrated in class. Tojo Mathew Asst. Professor CSE Dept., NIE Mysuru. UNIT 3: QUEUE Programs demonstrated in class. Tojo Mathew Asst. Professor CSE Dept., NIE Mysuru. Table of Contents 1. Simple Queue Implementation with arrays...3 2. Circular queue with global container

More information

Computers Programming Course 7. Iulian Năstac

Computers Programming Course 7. Iulian Năstac Computers Programming Course 7 Iulian Năstac Recap from previous course Operators in C Programming languages typically support a set of operators, which differ in the calling of syntax and/or the argument

More information

PROGRAM 1 AIM: Write a program to find the number of vertices, even vertices, odd vertices and the number of edges in a graph.

PROGRAM 1 AIM: Write a program to find the number of vertices, even vertices, odd vertices and the number of edges in a graph. PROGRAM 1 AIM: Write a program to find the number of vertices, even vertices, odd vertices and the number of edges in a graph. CODE: #include using namespace std; #include #define MAX

More information

Q 1. Attempt any TEN of the following:

Q 1. Attempt any TEN of the following: Subject Code: 17212 Model Answer Page No: 1 / 26 Important Instructions to examiners: 1) The answers should be examined by key words and not as word-to-word as given in the model answer scheme. 2) The

More information

DATA STRUCTURE. o DYNAMIC MEMORY. ALLOCATION o SELF-REFERENTIAL STRUCTURE o TYPEDEF LINK LIST STACK QUEUE TREE

DATA STRUCTURE. o DYNAMIC MEMORY. ALLOCATION o SELF-REFERENTIAL STRUCTURE o TYPEDEF LINK LIST STACK QUEUE TREE DATA STRUCTURE TOPICS PAGE o DYNAMIC MEMORY 2-5 ALLOCATION o SELF-REFERENTIAL STRUCTURE o TYPEDEF LINK LIST 5-16 STACK 17-28 o APPLICATION OF STACK 28-38 QUEUE 39-43 TREE o BINARY SEARCH TREE o HEAP GRAPH

More information