PES Institute of Technology-BSC QUESTION BANK



Similar documents
10CS35: Data Structures Using C

DATA STRUCTURES USING C

Krishna Institute of Engineering & Technology, Ghaziabad Department of Computer Application MCA-213 : DATA STRUCTURES USING C

Data Structure [Question Bank]

1) The postfix expression for the infix expression A+B*(C+D)/F+D*E is ABCD+*F/DE*++

5. A full binary tree with n leaves contains [A] n nodes. [B] log n 2 nodes. [C] 2n 1 nodes. [D] n 2 nodes.

Data Structures. Level 6 C Module Descriptor

Questions 1 through 25 are worth 2 points each. Choose one best answer for each.

Unit Write iterative and recursive C functions to find the greatest common divisor of two integers. [6]

GUJARAT TECHNOLOGICAL UNIVERSITY, AHMEDABAD, GUJARAT. Course Curriculum. DATA STRUCTURES (Code: )

Data Structure and Algorithm I Midterm Examination 120 points Time: 9:10am-12:10pm (180 minutes), Friday, November 12, 2010

Binary Heap Algorithms

CSE 326, Data Structures. Sample Final Exam. Problem Max Points Score 1 14 (2x7) 2 18 (3x6) Total 92.

Lab Manual. Data Structures (Pr): COT-213 Data Structures (P): IT-215

1. The memory address of the first element of an array is called A. floor address B. foundation addressc. first address D.

Atmiya Infotech Pvt. Ltd. Data Structure. By Ajay Raiyani. Yogidham, Kalawad Road, Rajkot. Ph : ,

Module 2 Stacks and Queues: Abstract Data Types

Sample Questions Csci 1112 A. Bellaachia

Data Structure with C

Data Structures Using C++ 2E. Chapter 5 Linked Lists

AP Computer Science AB Syllabus 1

Analysis of a Search Algorithm

Java Software Structures

Binary Search Trees CMPSC 122

Data Structures Fibonacci Heaps, Amortized Analysis

Abstract Data Type. EECS 281: Data Structures and Algorithms. The Foundation: Data Structures and Abstract Data Types

COMPUTER SCIENCE. Paper 1 (THEORY)

To My Parents -Laxmi and Modaiah. To My Family Members. To My Friends. To IIT Bombay. To All Hard Workers

The following themes form the major topics of this chapter: The terms and concepts related to trees (Section 5.2).

EE2204 DATA STRUCTURES AND ALGORITHM (Common to EEE, EIE & ICE)

PART-A Questions. 2. How does an enumerated statement differ from a typedef statement?

Algorithms and Data Structures

Binary Search Trees. A Generic Tree. Binary Trees. Nodes in a binary search tree ( B-S-T) are of the form. P parent. Key. Satellite data L R

Previous Lectures. B-Trees. External storage. Two types of memory. B-trees. Main principles

TREE BASIC TERMINOLOGIES

Data Structures UNIT III. Model Question Answer

MAX = 5 Current = 0 'This will declare an array with 5 elements. Inserting a Value onto the Stack (Push)

ECE 250 Data Structures and Algorithms MIDTERM EXAMINATION /5:15-6:45 REC-200, EVI-350, RCH-106, HH-139

Ordered Lists and Binary Trees

Data Structures and Algorithms Written Examination

From Last Time: Remove (Delete) Operation

B-Trees. Algorithms and data structures for external memory as opposed to the main memory B-Trees. B -trees

Learning Outcomes. COMP202 Complexity of Algorithms. Binary Search Trees and Other Search Trees

BCS2B02: OOP Concepts and Data Structures Using C++

KITES TECHNOLOGY COURSE MODULE (C, C++, DS)

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING LESSON PLAN

ML for the Working Programmer

Binary Search Trees. Data in each node. Larger than the data in its left child Smaller than the data in its right child

Heaps & Priority Queues in the C++ STL 2-3 Trees

Exam study sheet for CS2711. List of topics

Converting a Number from Decimal to Binary

Stacks. Linear data structures

Common Data Structures

Home Page. Data Structures. Title Page. Page 1 of 24. Go Back. Full Screen. Close. Quit

Data Structures and Algorithms

Chapter 3: Restricted Structures Page 1

Unordered Linked Lists

Objected oriented Programming: C++ Unit 1 1. Introduction 1.1. Introduction to Object Oriented Programming C++ fundamentals.

S. Muthusundari. Research Scholar, Dept of CSE, Sathyabama University Chennai, India Dr. R. M.

Introduction to Data Structures

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

I PUC - Computer Science. Practical s Syllabus. Contents

Data Structures and Algorithms V Otávio Braga

University of Pune Revised Structure for the B. Sc. (Computer Science) Course (Second Year to be implemented from Academic Year )

Algorithms and Data Structures Written Exam Proposed SOLUTION

Cpt S 223. School of EECS, WSU

ALLIED PAPER : DISCRETE MATHEMATICS (for B.Sc. Computer Technology & B.Sc. Multimedia and Web Technology)

Introduction to Data Structures and Algorithms

Bangalore University B.Sc Computer Science Syllabus ( Semester System)

Syllabus for Computer Science. Proposed scheme for B.Sc Programme under Choice Based Credit System

Binary Trees and Huffman Encoding Binary Search Trees

B.Sc.(Computer Science) and. B.Sc.(IT) Effective From July 2011

International Journal of Software and Web Sciences (IJSWS)

CHAPTER 4 ESSENTIAL DATA STRUCTRURES

Symbol Tables. Introduction

Lecture 12 Doubly Linked Lists (with Recursion)

6 March Array Implementation of Binary Trees

Outline BST Operations Worst case Average case Balancing AVL Red-black B-trees. Binary Search Trees. Lecturer: Georgy Gimel farb

A binary search tree or BST is a binary tree that is either empty or in which the data element of each node has a key, and:

Any two nodes which are connected by an edge in a graph are called adjacent node.

Linked Lists, Stacks, Queues, Deques. It s time for a chainge!

A TOOL FOR DATA STRUCTURE VISUALIZATION AND USER-DEFINED ALGORITHM ANIMATION

Data Structures and Algorithm Analysis (CSC317) Intro/Review of Data Structures Focus on dynamic sets

Quiz 4 Solutions EECS 211: FUNDAMENTALS OF COMPUTER PROGRAMMING II. 1 Q u i z 4 S o l u t i o n s

ADTs,, Arrays, Linked Lists

Algorithms and data structures

Queues Outline and Required Reading: Queues ( 4.2 except 4.2.4) COSC 2011, Fall 2003, Section A Instructor: N. Vlajic

Class Notes CS Creating and Using a Huffman Code. Ref: Weiss, page 433

Stack & Queue. Darshan Institute of Engineering & Technology. Explain Array in detail. Row major matrix No of Columns = m = u2 b2 + 1

Binary Search Trees (BST)

CS104: Data Structures and Object-Oriented Design (Fall 2013) October 24, 2013: Priority Queues Scribes: CS 104 Teaching Team

The Union-Find Problem Kruskal s algorithm for finding an MST presented us with a problem in data-structure design. As we looked at each edge,

Section IV.1: Recursive Algorithms and Recursion Trees

Lecture Notes on Binary Search Trees

Exercises Software Development I. 11 Recursion, Binary (Search) Trees. Towers of Hanoi // Tree Traversal. January 16, 2013

CSE 326: Data Structures B-Trees and B+ Trees

Data Structures and Data Manipulation

Chapter 14 The Binary Search Tree

Lecture Notes on Binary Search Trees

Transcription:

PES Institute of Technology-BSC Faculty: Mrs. R.Bharathi CS35: Data Structures Using C QUESTION BANK UNIT I -BASIC CONCEPTS 1. What is an ADT? Briefly explain the categories that classify the functions of a data type.write an ADT for a natural number 2. What is time complexity? Determine the time complexity of an iterative and recursive functions that adds n elements of the array using tabular method 3. Define three asymptotic notations and give the asymptotic representation of function 3n+2 in all the three notations and prove the same from first principle method 4. Define Big Oh notation. Show that 3n+2 = O(n) is correct. 4 5. Explain performance analysis and performance measurement. Write recursive function to implement Binary search 7. Write an recursive function to sum a list of numbers and also show the total step 7 counts for the function. What is recursion? What are various types of recursion? 4 9. What is recursion? Explain types of recursion. Write a C program to search an element in a given array using recursive binary search.. What do you understand by dynamic memory allocation? Explain any three functions that support dynamic allocation? 11. What is an algorithm? Briefly explain the criteria that an algorithm must satisfy. 12. Define a pointer. Write a C function to swap two numbers using pointers. 5 13. What is a pointer and why is it used? 14. Define Pointer. With example explain pointer declaration and accessing data through pointers 15. What are the various memory allocation techniques? Explain how memory can 5 be dynamically allocated using malloc()? 1. Explain the functions supported by C to caary out dynamic memory allocation 5 17. Differentiate between static memory allocation and dynamic memory allocation. Explain malloc() and realloc(). 1. What are preprocessor directives? Explain any two operations that can be done using preprocessor directives 19. Bring out the differences between structures and unions. 5 UNIT II ARRAYS AND STRUCTURES 20. What is a structure? What are the different ways of declaring a structure? Explain with an example 21. Differentiate between Structure and Union with example 5

22. Incorporate a structure to contain details of a human being (name, age, salary 4 and date of birth) with date of birth containing month, day and year. 23. Write a C program with an appropriate structure definition and variable 12 declaration to store information about an employee, using nested structures. Consider the following fields like: ENAME, EMPID, DOJ(Date, Month, Year), Salary(Basic, DA, HRA) 12 24. What are structures? Explain how the structures are useful by giving various 2+4 examples. 25. What is the difference between int *a and int a[5] and int *[5]? 2. What is sparse matrix? Give ADT sparse matrix and show with a suitable example sparse matrix representation storing as triples. 27. Write a C program to read a sparse matrix of integer values and search this matrix for an element specified by the user. 2. What is a polynomial? What is the degree of the polynomial? Write a function to add two polynomials? 29. How would you represent two sparse polynomials using array of structure and also write a function to add that polynomials and store the result in the same array. 30. What is the degree of the polynomial? Consider the two polynomials A(x) = x 0 5 +1 and B(x)= x 3 + 3x 2 +1. Show diagrammatically how these two polynomials can be represented in a array. 31. Write ADT for Polynomial. What are different ways of representing a polynomial? Write a program to read, display and add two polynomials 32. What is a sparse matrix? Write a program to search an element in a given sparse matrix. UNIT III STACKS AND QUEUES 33. Define stack. What are the different operations that can be performed on stack? Write a C program to implement all stack operations 34. Explain System stack in detail. 5 35. Write a note on multiple stacks 5 3. Explain how the stack is used in parameter passing 4 37. Write short notes on dynamic stack representation 5 3. Show the stack after each operation of the following sequence that starts with the empty stack: push(a), push(b), pop, push(c), push(d), pop 39. Define Stack as a data structure and discuss its applications 40. List applications of stacks. Using stack write an algorithm to determine if a given string is palindrome and print suitable message as output. 41. Obtain prefix and postfix expression a. (A+B)*(C+D)$(A+B) b. A+B*C-D/E*H c. (A+B^C^D)*(E+F/D) 42. List the various ways of representing the arithmetic expressions by giving suitable examples 4

43. Show the detailed concept of the stack to evaluate the following positive expression 32-5*+1^7+ * 44. Write the prefix and postfix form of the following infix expressions ((A + B) * C -(D-E)) $(F+G) b) (A+B)*(C+D-E)*F 45. Implement stack using static and dynamic memory allocation. Discuss the relative merits of these two implementations 4. Write a program to check whether a given expression is a valid postfix expression or not. If valid evaluate a given postfix expression otherwise display a suitable message. 47. Write an algorithm for converting infix expression to post-fix expression. Trace the algorithm indicating content of stack for expression (a-b)/(c*d)+e 4. What are STACK? Explain operation performed on STACK. Discuss how the stack structure can be used for Tower of Hanoi problem 49. Convert the following infix expression into a postfix expression using stack i) a * (b+c) *d ii) ((a+b) * d + e)/((f+a*d) +c) 7 7 50. Show that, how stack operations takes place for the conversion of infix to postfix 7 expression. ((A-(B+C)) *D) $(E+F) 51. Write an algorithm to implement a stack of size N using an array. The elements in the stack are to be integers. The operations to be supported are PUSH, POP and DISPLAY. Take into account the exceptions of Stack overflow and underflow 52. Define queue. What are the different operations that can be performed on queue? Write a C program to implement all queue operations 53. Distinguish between Ordinary queues and Circular queues 4 54. Write a program to implement a linear queue using arrays. Take into account the exceptions like Queue Full and Queue Empty. 55. Write a C function i) to insert an element at the rear end of a queue ii) to delete an element from the front end of the queue 5. A circular queue has a size of 5 and has 3 elements, 40 and 20, where F=2 and R=4. After inserting 50 and 0, what is value of F and R. Trying to insert 30 at this stage what will happen? Delete 2 elements from the queue and insert 0. Show the sequences of steps with necessary diagrams with the value of F and R UNIT III LINKED LISTS 57. What is a SLL? Write a program to implement stack as a singly linked list 5. What are the advantages and disadvantages of linked lists over arrays? 4 59. What are different types of linked list? Write a C function to count number of 7 elements present in single linked list. 0. Write a recursive search routine to search for a node in a SLL

1. Write an algorithm to concatenate two lists (assume both are existing) 2. Write a C function to a. To count number of nodes using singly linked list b. To concatenate two singly linked list, and then to sort the resultant list c. To reverse direction of singly linked list(as shown below) 3. Write a program to represent a polynomial of single variable using linked list and perform the following functions a. Evaluation of polynomial b. Display the polynomial 4. Define and implement doubly link list 5. Write advantages of doubly linked list over singly linked list. Write C function that will insert a given integer value into an ordered doubly linked list.. What is a single linked list? Explain with an example how a single linked list can 7 be used for sorting a set of N numbers. 7. Write a program to find for a particular node (either the position or info of the 7 node can be given) in a DLL or circular DLL. What are the advantages and disadvantages of doubly linked list? Also give its applications 9. Write a C function to insert and delete a node from the front end in case of 4 doubly linked List. 70. Implement a circular SLL with the header node containing the total no of nodes in the list. The node itself consists of student details like reg no, name, marks etc. 71. What are the advantages of circularly linked list over a linear list? Write a C routine that concatenates two circular lists. 72. Write C functions to perform the following operations: a. Create a circular singly linked list b. Display Circular singly linked list 73. Write a function to insert a node at front and rear end in a circular linked list. Write down sequence of steps to be followed UNIT III STACKS AND QUEUES 74. Define stack. What are the different operations that can be performed on stack? Write a C program to implement all stack operations

75. Explain System stack in detail. 5 7. Write a note on multiple stacks 5 77. Explain how the stack is used in parameter passing 4 7. Write short notes on dynamic stack representation 5 79. Show the stack after each operation of the following sequence that starts with the empty stack: push(a), push(b), pop, push(c), push(d), pop 0. Define Stack as a data structure and discuss its applications 1. List applications of stacks. Using stack write an algorithm to determine if a given string is palindrome and print suitable message as output. 2. Obtain prefix and postfix expression a. (A+B)*(C+D)$(A+B) b. A+B*C-D/E*H c. (A+B^C^D)*(E+F/D) 3. List the various ways of representing the arithmetic expressions by giving suitable examples 4. Show the detailed concept of the stack to evaluate the following positive expression 32-5*+1^7+ * 5. Write the prefix and postfix form of the following infix expressions ((A + B) * C -(D-E)) $(F+G) b) (A+B)*(C+D-E)*F. Implement stack using static and dynamic memory allocation. Discuss the relative merits of these two implementations 7. Write a program to check whether a given expression is a valid postfix expression or not. If valid evaluate a given postfix expression otherwise display a suitable message.. Write an algorithm for converting infix expression to post-fix expression. Trace the algorithm indicating content of stack for expression (a-b)/(c*d)+e 9. What are STACK? Explain operation performed on STACK. Discuss how the stack structure can be used for Tower of Hanoi problem 90. Convert the following infix expression into a postfix expression using stack i) a * (b+c) *d ii) ((a+b) * d + e)/((f+a*d) +c) 4 7 7 91. Show that, how stack operations takes place for the conversion of infix to postfix 7 expression. ((A-(B+C)) *D) $(E+F) 92. Write an algorithm to implement a stack of size N using an array. The elements in the stack are to be integers. The operations to be supported are PUSH, POP and DISPLAY. Take into account the exceptions of Stack overflow and underflow 93. Define queue. What are the different operations that can be performed on queue? Write a C program to implement all queue operations 94. Distinguish between Ordinary queues and Circular queues 4 95. Write a program to implement a linear queue using arrays. Take into account the

exceptions like Queue Full and Queue Empty. 9. Write a C function i) to insert an element at the rear end of a queue ii) to delete an element from the front end of the queue 97. A circular queue has a size of 5 and has 3 elements, 40 and 20, where F=2 and R=4. After inserting 50 and 0, what is value of F and R. Trying to insert 30 at this stage what will happen? Delete 2 elements from the queue and insert 0. Show the sequences of steps with necessary diagrams with the value of F and R UNIT V & VI TREES I, TREES II and GRAPHS 9. What are the different ways to represent binary trees? Explain in detail. 99. What are the differences between strictly binary tree and complete binary tree 4 0. What is a TREE? Define the following a. Ancestor b. Descendants of node with respect to the TREE 1. Write C functions for following tree traversals 9 i) Inorder ii) Preorder iii) Post order 2. Write and explain with a function, level order tree traversal 3. What is a heap and what are the different types of heap 4. Give examples to show the father, son, descendent and ascendant nodes of a binary tree 5. What are the two conditions under which a binary tree becomes an almost 4 complete binary tree?. Given the following traversals In order: E I C F J B G D K H L A Preorder: A B C E I F J D G H K L Construct a Binary Tree 7.. Explain the different methods of representation of binary trees in "C". 5. Explain threaded binary trees in detail 9. Define the following a. Strict binary tree b. Almost complete binary tree c. Ordered tree d. Right in threaded binary tree 1. Write a C recursive program to find out the height of a binary tree. 5 111. Construct a binary tree for the expression A + (B-C)*(E+F)/G and draw the diagram showing each step. 112. Explain one-way and two-way threading of binary trees 5 113. Implement the recursive tree traversal of in, pre and post order traversals 114. Write an algorithms for deleting node in a binary search tree for all the three cases 115. Write an expression tree for the expression A/B*C*D+E. Give the C function for

inorder, preorder, post order traversals and apply the traversal methods to the expression tree and give the result of traversals 11. Write an algorithm for the iterative tree traversal 117. Write an algorithm to traverse the tree using father field 11. Construct a binary tree for the expression: ((7+(-3) * ) ^ 5+4) 4 119. Define the following terms with appropriate sketches a) Tree b) Directed tree c) Ordered tree d) Binary tree e) Spanning tree 120. Write recursive C routines to traverse a binary tree in different ways. Assume the dynamic node representation of a binary tree 121. Define a tree recursively. Define the following terms with example. Siblings i. Descendants ii. Complete Binary Tree iii. Strictly Binary Tree (Full Binary Tree) 122. What is heap? Explain the different types of heap? 4 123. Explain the following with an example: i) Forest ii) Graph iii) Winner tree 124. What is a binary search tree? Draw the binary search tree for the following input:14,5,,2,1,20,1,-1,21 125. Define ADT of Binary search tree. Write the iterative search function and recursive search function of BST 12. Explain with an example how to convert given forest into binary trees UNIT VII - PRIORITY QUEUES 127. Explain min and max heap with example. 12. Implement Fibonacci heap. 129. What is binomial heap? Explain the steps involved in the deletion of min element from a binomial heap. 130. Define a max heap. Write a C function to insert an item into max heap. 4 131. Write short notes on: i) Priority queues ii) Leftist trees iii) Fibonacci heaps 132. Briefly explain the following with an example: i) HBLT ii) WBLT 133. What is Fibonacci heap? Give suitable example and give the steps for deletion of node and decrease key of specified node in F-heap. 134. Explain Single ended and Double ended Priority Queue 4 135. Define F-Heap. Explain the operations: Delete and Decrease key 13. Define Pairing Heap. Explain the following operations: getmin, insert, deletemin, meld,delete, decreasekey.

UNIT VIII - EFFICIENT BINARY SEARCH TREES 137. What is an AVL tree? Write the algorithm to insert an item in to AVL tree. 13. Explain the different types of rotations of an AVL tree. 139. Write short notes on: i) Red-Black tree. ii) Splay trees. 140. Describe the following with an example: i) Height-balanced trees. ii) Optimal BST 141. Explain the Red-Black tree. State its properties 142. Explain i) Bottom-Up Splay Trees ii) Top-Down Splay Trees 143. Let h be the height of a red-black tree, let n be the number of internal nodes in the tree and r be the rank of the root then, prove that i) h 2r ii) n 2 r -1. 4