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?

Similar documents
DC54 DATA STRUCTURES DEC 2014

1 P a g e A r y a n C o l l e g e \ B S c _ I T \ C \

DYNAMIC MEMORY ALLOCATION AND DEALLOCATION

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

AE52/AC52/AT52 C & Data Structures JUNE 2014

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- MARCH, 2012 DATA STRUCTURE (Common to CT and IF) [Time: 3 hours

R13. II B. Tech I Semester Supplementary Examinations, May/June DATA STRUCTURES (Com. to ECE, CSE, EIE, IT, ECC)

Table of Contents. Chapter 1: Introduction to Data Structures... 1

DS ata Structures Aptitude

Visit ::: Original Website For Placement Papers. ::: Data Structure

DATA STRUCTURE : A MCQ QUESTION SET Code : RBMCQ0305

First Semester - Question Bank Department of Computer Science Advanced Data Structures and Algorithms...

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

Linear Data Structure

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

CT11 (ALCCS) DATA STRUCTURE THROUGH C JUN 2015

Prepared By: Ms. Nidhi Solanki (Assist. Prof.) Page 1

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

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

FORTH SEMESTER DIPLOMA EXAMINATION IN ENGINEERING/ TECHNOLIGY- OCTOBER, 2012 DATA STRUCTURE

Aryan College. Fundamental of C Programming. Unit I: Q1. What will be the value of the following expression? (2017) A + 9

INSTITUTE OF AERONAUTICAL ENGINEERING

Solution for Data Structure

Code No: R Set No. 1

17CS33:Data Structures Using C QUESTION BANK

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

Chapter 20: Binary Trees

Sample Question Paper

MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION

APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY THIRD SEMESTER B.TECH DEGREE EXAMINATION, JULY 2017 CS205: DATA STRUCTURES (CS, IT)

R10 SET - 1. Code No: R II B. Tech I Semester, Supplementary Examinations, May

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

a) State the need of data structure. Write the operations performed using data structures.

Syllabus for Bachelor of Technology. Computer Engineering. Subject Code: 01CE0301. Subject Name: Data Structure. B.Tech. Year - II

A6-R3: DATA STRUCTURE THROUGH C LANGUAGE

Answers. 1. (A) Attempt any five : 20 Marks

Binary Search Tree 1.0. Generated by Doxygen Mon Jun :12:39

Revision Statement while return growth rate asymptotic notation complexity Compare algorithms Linear search Binary search Preconditions: sorted,

Frequently asked Data Structures Interview Questions

MLR Institute of Technology

S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Data Structure using C

Linked List. April 2, 2007 Programming and Data Structure 1

SAURASHTRA UNIVERSITY

Cpt S 122 Data Structures. Course Review Midterm Exam # 1

CP2 Revision. theme: dynamic datatypes & data structures

Ashish Gupta, Data JUET, Guna

Data Structures Question Bank Multiple Choice

STACKS 3.1 INTRODUCTION 3.2 DEFINITION

S.E. Sem. III [INFT] Data Structures & Analysis. Primitive Linear Non Linear

A. Year / Module Semester Subject Topic 2016 / V 2 PCD Pointers, Preprocessors, DS

Department of Computer Science and Technology

Linked Lists in C and C++

End-Term Examination Second Semester [MCA] MAY-JUNE 2006

Data Structures Through C. Student Handout Book

IN COLLABORATION WITH IVTB. Diploma in Information Technology

Bachelor Level/ First Year/ Second Semester/ Science Full Marks: 60 Computer Science and Information Technology (CSc. 154) Pass Marks: 24

S.E. Sem. III [CMPN] Data Structures. Primitive Linear Non Linear

Algorithms, Data Structures, and Problem Solving

DC54 DATA STRUCTURES JUNE 2013

PESIT Bangalore South Campus Department of MCA Course Information for

Lecture 7: Data Structures. EE3490E: Programming S1 2017/2018 Dr. Đào Trung Kiên Hanoi Univ. of Science and Technology

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct.

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

Data Structures Through C. Student Workbook

CS 241 Data Organization Binary Trees

COP 3502 Section 2 Exam #2 Version A Spring /23/2017

Data Structures and Algorithms Notes

Objective Questions for Online Practical Exams under CBCS Scheme Subject: Data Structure-I (CS-113)

MODULE 5: Pointers, Preprocessor Directives and Data Structures

MODULE V: POINTERS & PREPROCESSORS

DEPARTMENT OF COMPUTER APPLICATIONS B.C.A. - FIRST YEAR ( REGULATION) SECOND SEMESTER LESSON PLAN SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

DATA STRUCTURE. 1- What data structure can be used to check if a syntax has balanced paranthesis? A - queue B - tree C - list D - stack

8. Write an example for expression tree. [A/M 10] (A+B)*((C-D)/(E^F))

DATA STRUCTURES USING C

ECE264 Spring 2013 Final Exam, April 30, 2013

MTH 307/417/515 Final Exam Solutions

Reg. No. : Question Paper Code : 27157

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

Total No. of Questions :09] [Total No. of Pages : 02. II/IV B.Tech. DEGREE EXAMINATIONS, NOV/DEC First Semester CSE/IT DATA STRUCTURES USING C

Algorithm Class. C C++ DS JAVA DATA STRUCTURES TRAINING INSTITUTE KPHB HYDERABAD. Mobile:

I Year MCA I Semester L T P To C FOUNDATIONS OF INFORMATION TECHNOLOGY

VALLIAMMAI ENGNIEERING COLLEGE SRM Nagar, Kattankulathur DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK

DATA STRUCUTRES. A data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.

Programming and Data Structure Solved. MCQs- Part 2

PROGRAMMAZIONE I A.A. 2017/2018

LESSON PLAN B.C.A. - FIRST YEAR ( REGULATION) SECOND SEMESTER

Recursion, Trees and Tree Traversal. Module CE System Programming & Computer Control Systems

CS8391-DATA STRUCTURES QUESTION BANK UNIT I

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING B.E SECOND SEMESTER CS 6202 PROGRAMMING AND DATA STRUCTURES I TWO MARKS UNIT I- 2 MARKS

Subject: Fundamental of Computer Programming 2068

Tribhuvan University Institute of Science and Technology Computer Science and Information Technology (CSC. 154) Section A Attempt any Two questions:

1) What is the primary purpose of template functions? 2) Suppose bag is a template class, what is the syntax for declaring a bag b of integers?

Sample Problems for Quiz # 3

CS 8391 DATA STRUCTURES

Largest Online Community of VU Students

PRACTICAL LIST FOR EVEN SEMESTERS (PGDCA/MCA/MSC (CS))

BE ISE 3 rd Semester

Bharati Vidyapeeth s College Of Engineering for Women Pune-43 Department E & TC. SE- Unit Test I Subject-DS

DATA STRUCTURES THROUGH C++

Cpt S 122 Data Structures. Data Structures

Transcription:

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 pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type. b. What is the data structures used to perform recursion? Stack. Because of its LIFO (Last In First Out) property it remembers its 'caller' so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls. Every recursive function has its equivalent iterative (nonrecursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used. c. Write a recursive function to find factorial of a given number. Page 128 of Text Book 1 Q.3 a. What is difference between structure and union? Write a program that will read and print the data for 10 students using the following structure: struct student char name [30]; float mark; Page 141 to 142 of Text Book 1 b. Define file. Explain the major operations performed on sequential file. Page 147 of Text Book 1 Q.4 a. Write an algorithm in C to implement bubble sort technique. Page 194 of Text Book 1 b. Explain the procedure for Binary Search technique with the help of an example. Page 213 to 215 of Text Book 1 Q.5 a. Write the difference between a stack and a queue. Write a program in C to implement queue using linked list. Page 252 to 253 of Text Book 1 IETE 1

b. Translate the following infix expression into its equivalent postfix expression using stack: A*(B+D)/E-F*(G+H/K) A*(B+D)/E-F*(G+H/K) = A*[BD+]/E-F*(G+[HK/]) = [ABD+*]E-F*[GHK/+] =[ABD+*E/]-[FGHK/+*] = ABD+*E/FGHK/+*- Q.6 a. Write a procedure to reverse a singly linked list. A procedure to reverse a singly linked list: reverse(struct node **st) struct node *p, *q, *r; p = *st; q = NULL; while(p!= NULL) r =q; q = p; p = p _ link; q _ link = r; *st = q; b. Write a function which inserts a newly created node after a specified node. Page 281 of Text Book 1 Q7 a. Define Circular Linked List. Write a program for creating and printing the elements of a Circular Linked List. Page 315 to 16-17 of Text Book 1 b. What are the disadvantages of single linked list? How these problems are solved by doubly linked list? Page 330 to 331 of text Book 1 Q8. a. Define Binary tree. How binary trees are represented in memory? Page 349 to 353 of text Book 1 IETE 2

b. Write the Preorder, Inorder and Postorder traversal for the following tree: Page 355 of text Book 1 Q9 a. Define the following with the help of example: (i) Adjacency Matrix of a graph (ii) Adjacency List of a graph (iii) In-degree and out-degree of a graph (iv) Directed Acyclic Graph (DAG) Page 390,392,393 to 420 of text Book 1 b. Write a program that implements depth first search algorithm #include <stdio.h> #include <conio.h> #include <alloc.h> #define TRUE 1 #define FALSE 0 #define MAX 8 struct node int data ; struct node *next ; ; int visited[max] ; void dfs ( int, struct node ** ) ; struct node * getnode_write ( int ) ; void del ( struct node * ) ; void main( ) struct node *arr[max] ; struct node *v1, *v2, *v3, *v4 ; IETE 3

int i ; clrscr( ) ; arr[0] = v1 ; v1 -> next = v2 = getnode_write ( 3 ) ; v1 = getnode_write ( 1 ) ; arr[1] = v1 ; v1 -> next = v2 = getnode_write ( 4 ) ; v2 -> next = v3 = getnode_write ( 5 ) ; v3 -> next = NULL ; v1 = getnode_write ( 1 ) ; arr[2] = v1 ; v1 -> next = v2 = getnode_write ( 6 ) ; v2 -> next = v3 = getnode_write ( 7 ) ; v3 -> next = NULL ; arr[3] = v1 ; arr[4] = v1 ; v1 = getnode_write ( 3 ) ; arr[5] = v1 ; v1 = getnode_write ( 3 ) ; arr[6] = v1 ; v1 = getnode_write ( 4 ) ; arr[7] = v1 ; v1 -> next = v2 = getnode_write ( 5 ) ; v2 -> next = v3 = getnode_write ( 6 ) ; v3 -> next = v4 = getnode_write ( 7 ) ; v4 -> next = NULL ; dfs ( 1, arr ) ; for ( i = 0 ; i < MAX ; i++ ) del ( arr[i] ) ; getch( ) ; void dfs ( int v, struct node **p ) struct node *q ; IETE 4

visited[v - 1] = TRUE ; printf ( "%d\t", v ) ; q = * ( p + v - 1 ) ; while ( q!= NULL ) if ( visited[q -> data - 1] == FALSE ) dfs ( q -> data, p ) ; else q = q -> next ; struct node * getnode_write ( int val ) struct node *newnode ; newnode = ( struct node * ) malloc ( sizeof ( struct node ) ) ; newnode -> data = val ; return newnode ; void del ( struct node *n ) struct node *temp ; while ( n!= NULL ) temp = n -> next ; free ( n ) ; n = temp ; Text Book C & Data Structuress, P.S. Deshpande and O.G. Kakde, Dream tech press, 2007 IETE 5