21. State the rules to be followed during infix to postfix conversions
• Fully parenthesize the expression starting from left to right. During parenthesizing, the operators having higher precedence are first parenthesized
• Move the operators one by one to their right, such that each operator replaces their corresponding right parenthesis
• The part of the expression, which has been converted into postfix is to be treated as single operand
• Once the expression is converted into postfix form, remove all parenthesis
22. State the rules to be followed during infix to prefix conversions
• Fully parenthesize the expression starting from left to right. During parenthesizing, the operators having higher precedence are first parenthesized
• Move the operators one by one to their left, such that each operator replaces their corresponding left parenthesis
• The part of the expression, which has been converted into prefix is to be treated as single operand
• Once the expression is converted into prefix form, remove all parenthesis
23. State the difference between stacks and linked lists
The difference between stacks and linked lists is that insertions and deletions may occur anywhere in a linked list, but only at the top of the stack
24. Mention the advantages of representing stacks using linked lists than arrays
• It is not necessary to specify the number of elements to be stored in a stack during its declaration, since memory is allocated dynamically at run time when an element is added to the stack
• Insertions and deletions can be handled easily and efficiently
• Linked list representation of stacks can grow and shrink in size without wasting memory space, depending upon the insertion and deletion that occurs in the list
• Multiple stacks can be represented efficiently using a chain for each stack
25. Define a queue
Queue is an ordered collection of elements in which insertions are restricted to one end called the rear end and deletions are restricted to other end called the front end. Queues are also referred as First-In-First-Out (FIFO) Lists.
26. Define a priority queue
Priority queue is a collection of elements, each containing a key referred as the priority for that element. Elements can be inserted in any order (i.e., of alternating priority), but are arranged in order of their priority value in the queue. The elements are deleted from the queue in the order of their priority (i.e., the elements with the highest priority is deleted first). The elements with the same priority are given equal importance and processed accordingly.
27. State the difference between queues and linked lists
The difference between queues and linked lists is that insertions and deletions may occur anywhere in the linked list, but in queues insertions can be made only in the rear end and deletions can be made only in the front end.
28. Define a Deque
Deque (Double-Ended Queue) is another form of a queue in which insertions and deletions are made at both the front and rear ends of the queue. There are two variations of a deque, namely, input restricted deque and output restricted deque. The input restricted deque allows insertion at one end (it can be either front or rear) only. The output restricted deque allows deletion at one end (it can be either front or rear) only.
29. Why you need a data structure?
A data structure helps you to understand the relationship of one data element with the other and organize it within the memory. Sometimes the organization might be simple and can be very clearly visioned. Eg) List of names of months in a year –Linear Data Structure, List of historical places in the world- Non-Linear Data Structure. A data structure helps you to analyze the data, store it and organize it in a logical and mathematical manner.
30. What are the objectives of studying data structures?
• To identify and create useful mathematical entities and operations to determine what classes of problems can be solved using these entities and operations
• To determine the representation of these abstract entities and to implement the abstract operations on these concrete representation
• Fully parenthesize the expression starting from left to right. During parenthesizing, the operators having higher precedence are first parenthesized
• Move the operators one by one to their right, such that each operator replaces their corresponding right parenthesis
• The part of the expression, which has been converted into postfix is to be treated as single operand
• Once the expression is converted into postfix form, remove all parenthesis
22. State the rules to be followed during infix to prefix conversions
• Fully parenthesize the expression starting from left to right. During parenthesizing, the operators having higher precedence are first parenthesized
• Move the operators one by one to their left, such that each operator replaces their corresponding left parenthesis
• The part of the expression, which has been converted into prefix is to be treated as single operand
• Once the expression is converted into prefix form, remove all parenthesis
23. State the difference between stacks and linked lists
The difference between stacks and linked lists is that insertions and deletions may occur anywhere in a linked list, but only at the top of the stack
24. Mention the advantages of representing stacks using linked lists than arrays
• It is not necessary to specify the number of elements to be stored in a stack during its declaration, since memory is allocated dynamically at run time when an element is added to the stack
• Insertions and deletions can be handled easily and efficiently
• Linked list representation of stacks can grow and shrink in size without wasting memory space, depending upon the insertion and deletion that occurs in the list
• Multiple stacks can be represented efficiently using a chain for each stack
25. Define a queue
Queue is an ordered collection of elements in which insertions are restricted to one end called the rear end and deletions are restricted to other end called the front end. Queues are also referred as First-In-First-Out (FIFO) Lists.
26. Define a priority queue
Priority queue is a collection of elements, each containing a key referred as the priority for that element. Elements can be inserted in any order (i.e., of alternating priority), but are arranged in order of their priority value in the queue. The elements are deleted from the queue in the order of their priority (i.e., the elements with the highest priority is deleted first). The elements with the same priority are given equal importance and processed accordingly.
27. State the difference between queues and linked lists
The difference between queues and linked lists is that insertions and deletions may occur anywhere in the linked list, but in queues insertions can be made only in the rear end and deletions can be made only in the front end.
28. Define a Deque
Deque (Double-Ended Queue) is another form of a queue in which insertions and deletions are made at both the front and rear ends of the queue. There are two variations of a deque, namely, input restricted deque and output restricted deque. The input restricted deque allows insertion at one end (it can be either front or rear) only. The output restricted deque allows deletion at one end (it can be either front or rear) only.
29. Why you need a data structure?
A data structure helps you to understand the relationship of one data element with the other and organize it within the memory. Sometimes the organization might be simple and can be very clearly visioned. Eg) List of names of months in a year –Linear Data Structure, List of historical places in the world- Non-Linear Data Structure. A data structure helps you to analyze the data, store it and organize it in a logical and mathematical manner.
30. What are the objectives of studying data structures?
• To identify and create useful mathematical entities and operations to determine what classes of problems can be solved using these entities and operations
• To determine the representation of these abstract entities and to implement the abstract operations on these concrete representation
No comments:
Post a Comment