Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
42 views

Data Structures Design - AD3251 - Important Questions with Answer - Unit 2 - Linear Structures

The document outlines the curriculum for the 2nd semester of a B.Tech program in Artificial Intelligence and Data Science at Anna University, including various subjects and a question bank for the Data Structures Design course. It covers topics such as linear and non-linear data structures, operations on data structures, and specific types like stacks and queues. Additionally, it provides definitions, advantages, and applications of different data structures, along with sample questions and answers.

Uploaded by

sramalingam28
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views

Data Structures Design - AD3251 - Important Questions with Answer - Unit 2 - Linear Structures

The document outlines the curriculum for the 2nd semester of a B.Tech program in Artificial Intelligence and Data Science at Anna University, including various subjects and a question bank for the Data Structures Design course. It covers topics such as linear and non-linear data structures, operations on data structures, and specific types like stacks and queues. Additionally, it provides definitions, advantages, and applications of different data structures, along with sample questions and answers.

Uploaded by

sramalingam28
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

All 2nd Semester Subjects

Professional English - II - HS3252 Engineering Graphics - GE3251


Statistics and Numerical Methods - Physics for Electronics Engineering -
MA3251 PH3254
Physics for Electrical Engineering - Physics for Civil Engineering - PH3201
PH3202
Materials Science - PH3251 Basic Electrical and Electronics
Engineering - BE3251
Physics for Information Science - Basic Civil and Mechanical Engineering -
PH3256 BE3255
Basic Electrical and Instrumentation Electric Circuit Analysis (Circuit
Engineering - BE3254 Theory) - EE3251
Programming in C - CS3251 Circuit Analysis - EC3251
Data Structures Design - AD3251
www.BrainKart.com
4931_Grace College of Engineering,Thoothukudi

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

B.Tech. - Artificial Intelligence and Data Science

Anna University Regulation: 2021

AD3251- DATA STRUCTURES DESIGN

I Year/II Semester

QUESTION BANK

Unit- II LINEAR STRUCTURES

Prepared By,

Mr. S. MANICKAM, AP/CSE

AD3251_DSD_R2021

https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
4931_Grace College of Engineering, Thoothukudi
www.BrainKart.com
UNIT II – 2 Marks Questions with Answers

List ADT – array-based implementations – linked list implementations – singly linkedlists


– circularly linked lists – doubly linked lists – applications of lists – Stack ADT – Queue ADT –
double ended queues

1. Define data structure.


The data structure can be defined as the collection of elements and all the possibleoperations
which are required for those set of elements.
It is a way of organizing data that considers not only the items stored but also their
relationship to each other.
Ex: Array, Linked List, Stack, Queue etc.

2. What do you mean by non-linear data structure? Give example.


The non-linear data structure is the kind of data structure in which the data may bearranged
in hierarchical fashion.
For example- Trees and graphs.

3. What do you mean linear data structure? Give example.


The linear data structure is the kind of data structure in which the data is linearlyarranged.
For example- stacks, queues, linked list.

4. List the various operations that can be performed on data structure.


Various operations that can be performed on the data structure are
• Create
• Insertion of element
• Deletion of element
• Searching for the desired element
• Sorting the elements in the data structure
• Reversing the list of elements.

5. What is abstract data type? What are all not concerned in an ADT?
The abstract data type is a triple of D i.e. set of axioms, F-set of functions and A- Axioms in
which only what is to be done is mentioned but how is to be done is not mentioned.Thus ADT is not
concerned with implementation details.

6. List out the areas in which data structures are applied extensively.
Following are the areas in which data structures are applied extensively.
• Operating system - the data structures like priority queues are used for schedulingthe jobs in
the operating system.
• Compiler design - the tree data structure is used in parsing the source program.Stack data
structure is used in handling recursive calls.

AD3251_DSD_R2021
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
4931_Grace College of Engineering, Thoothukudi
www.BrainKart.com

• Database management system - The file data structure is used in database management
systems. Sorting and searching techniques can be applied on thesedata in the file.
• Numerical analysis package - the array is used to perform the numerical analysison the
given set of data.
• Graphics - the array and the linked list are useful in graphics applications.
• Artificial intelligence - the graph and trees are used for the applications like building
expression trees, game playing.

7. What is a linked list?


A singly linked list, is a collection of nodes that collectively form a linear sequence. It is a set
of nodes where each node has two fields ‘data’ and ‘link’. The data field is used to store actual piece of
information and link field is used to store address of next node.

Singly Linked List Node Representation

Singly Linked List Representation

8. What are the pitfall encountered in singly linked list?


Following are the pitfall encountered in singly linked list
• The singly linked list has only forward pointer and no backward link is provided. Hencethe
traversing of the list is possible only in one direction. Backward traversing is not possible.
• Insertion and deletion operations are less efficient because for inserting the elementat desired
position the list needs to be traversed. Similarly, traversing of the list is required for locating
the element which needs to be deleted.

9. Define doubly linked list.


Doubly linked list is a kind of linked list in which each node has two link fields. One linkfield
stores the address of previous node and the other link field stores the address of the nextnode.

Doubly Linked List Structure

AD3251_DSD_R2021
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
4931_Grace College of Engineering, Thoothukudi
www.BrainKart.com
10. Write down the steps to modify a node in linked lists.
• Enter the position of the node which is to be modified.
• Enter the new value for the node to be modified.
• Search the corresponding node in the linked list.
• Replace the original value of that node by a new value.
• Display the messages as “The node is modified”.

11. Difference between arrays and lists.


In arrays any element can be accessed randomly with the help of index of array, whereas in lists
any element can be accessed by sequential access only.
Insertion and deletion of data is difficult in arrays on the other hand insertion and deletion of
data is easy in lists.

12. State the properties of LIST abstract data type with suitable example.
Various properties of LIST abstract data type are
• It is linear data structure in which the elements are arranged adjacent to each other.
• It allows to store single variable polynomial.
• If the LIST is implemented using dynamic memory then it is called linked list. Exampleof
LIST are- stacks, queues, linked list.

13. State the advantages of circular lists over doubly linked list.
In circular list the next pointer of last node points to head node, whereas in doubly linked list
each node has two pointers: one previous pointer and another is next pointer. The main advantage of
circular list over doubly linked list is that with the help of single pointer fieldwe can access head node
quickly. Hence some amount of memory get saved because in circular list only one pointer is reserved.

14. What are the advantages of doubly linked list over singly linked list?
The doubly linked list has two pointer fields. One field is previous link field and anotheris next
link field. Because of these two pointer fields we can access any node efficiently whereas in singly
linked list only one pointer field is there which stores forward pointer.

15. Why is the linked list used for polynomial arithmetic?


We can have separate coefficient and exponent fields for representing each term of polynomial.
Hence there is no limit for exponent. We can have any number as an exponent.

16. What is the advantage of linked list over arrays?


The linked list makes use of the dynamic memory allocation. Hence the user can allocate or de
allocate the memory as per his requirements. On the other hand, the array makes use of the static memory
location. Hence there are chances of wastage of the memoryor shortage of memory for allocation.

17. What is the circular linked list?


The circular linked list is a kind of linked list in which the last node is connected to thefirst
node or head node of the linked list.
Singly circular linked list

A2 A3
A1

AD3251_DSD_R2021
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
4931_Grace College of Engineering, Thoothukudi
www.BrainKart.com
18. What is the basic purpose of header of the linked list?
The header node is the very first node of the linked list. Sometimes a dummy value such - 999
is stored in the data field of header node.

19. What is the advantage of an ADT?


• Change: the implementation of the ADT can be changed without making changes in
theclient program that uses the ADT.
• Understandability: ADT specifies what is to be done and does not specify
theimplementation details. Hence code becomes easy to understand due to ADT.
• Reusability: the ADT can be reused by some program in future.

20. What is static linked list?


State any two applications of it.
• The linked list structure which can be represented using arrays is called static linkedlist.
• It is easy to implement, hence for creation of small databases, it is useful.
• The searching of any record is efficient, hence the applications in which the recordneed to
be searched quickly when the static linked list are used.
21. Define Stack
A Stack is an ordered list in which all insertions (Push operation) and deletion (Pop operation)
are made at one end, called the top. The topmost element is pointed by top. The top is initialized to -1
when the stack is created that is when the stack is empty.
In a stack S = (a1,an), a1 is the bottom most element and element a is on top of elementai-1.
Stack is also referred as Last In First Out (LIFO) list.

22. What are the various Operations performed on the Stack?


The various operations that are performed on the stack are CREATE(S) – Creates Sas an
empty stack. PUSH(S,X) – Adds the element X to the top of the stack. POP(S) – Deletesthe top most
elements from the stack. TOP(S) – returns the value of top element from the stack. ISEMTPTY(S)
– returns true if Stack is empty else false. ISFULL(S) - returns true if Stack is full else false.

23. Explain the usage of stack in recursive algorithm implementation?


In recursive algorithms, stack data structures is used to store the return address whena
recursive call is encountered.
Also it stores the values of all the parameters essential to the current state of thefunction.
Recursion makes a program more readable.
In latest enhanced CPU systems, recursion is more efficient than iterations.
24. Define Queue.
A Queue is an ordered list in which all insertions take place at one end called the rear,while all
deletions take place at the other end called the front. Rear is initialized to -1 and frontis initialized to 0.
Queue is also referred as First In First Out (FIFO) list.

25. What are the various operations performed on the Queue?


The various operations performed on the queue are CREATE(Q) – Creates Q as anempty
Queue.
Enqueue(Q,X) – Adds the element X to the Queue.

AD3251_DSD_R2021
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
4931_Grace College of Engineering, Thoothukudi
www.BrainKart.com
Dequeue(Q) – Deletes a element from the Queue.
ISEMTPTY(Q) – returns true if Queue is empty else false.
ISFULL(Q) - returns true if Queue is full else false.

26. How do you test for an empty Queue?


The condition for testing an empty queue is rear=front-1. In linked list implementationof
queue the condition for an empty queue is the header node link field is NULL.
bool isEmpty(Queue Q)
{
If(Q->Rear==-1)
return (true)
}

27. Define Dequeue.


Deque stands for Double ended queue. It is a linear list in which insertions and deletionare made
from either end of the queue structure.

28. Write down the function to insert an element into a queue, in which the queue is
implemented as an array.
void enqueue (int X, Queue Q)
{
if(IsFull(Q))
Error (“Full queue”);
else
{
Q->Size++;
Q->Rear = Q->Rear+1;
Q->Array[ Q->Rear ]=X;
}
}

29. Define Circular Queue.


Another representation of a queue, which prevents an excessive use of memory by arranging
elements/ nodes Q1,Q2,…Qn in a circular fashion. That is, it is the queue, which wraps around upon
reaching the end of the queue
30. List any four applications of stack.
• Parsing context free languages, Evaluating arithmetic expressions, Function call, Traversing trees and
graph and Tower of Hanoi

PART -B

1.Applications of Stack. (8)


2. Doubly Ended Queue (12)
3. Doubly Linked List (12)
4. Circular Linked List (12)
5. Singly Linked List (16)
6.Queue (8)

AD3251_DSD_R2021
https://play.google.com/store/apps/details?id=info.therithal.brainkart.annauniversitynotes&hl=en_IN
All 2nd Semester Subjects
Professional English - II - HS3252 Engineering Graphics - GE3251
Statistics and Numerical Methods - Physics for Electronics Engineering -
MA3251 PH3254
Physics for Electrical Engineering - Physics for Civil Engineering - PH3201
PH3202
Materials Science - PH3251 Basic Electrical and Electronics
Engineering - BE3251
Physics for Information Science - Basic Civil and Mechanical Engineering -
PH3256 BE3255
Basic Electrical and Instrumentation Electric Circuit Analysis (Circuit
Engineering - BE3254 Theory) - EE3251
Programming in C - CS3251 Circuit Analysis - EC3251
Data Structures Design - AD3251

You might also like