0% found this document useful (0 votes)
5 views3 pages

Important Questions PartB C

The document provides an overview of various data structures and algorithms, including polynomial addition using linked lists, singly and doubly linked lists, stack operations, radix sort, circular queues, binary search trees, tree traversals, infix to postfix conversions, and double-ended queues (DEQUE). Each section includes definitions, algorithms, operations, and examples where applicable. The content emphasizes the advantages and limitations of each data structure and algorithm.

Uploaded by

deepeshharshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Important Questions PartB C

The document provides an overview of various data structures and algorithms, including polynomial addition using linked lists, singly and doubly linked lists, stack operations, radix sort, circular queues, binary search trees, tree traversals, infix to postfix conversions, and double-ended queues (DEQUE). Each section includes definitions, algorithms, operations, and examples where applicable. The content emphasizes the advantages and limitations of each data structure and algorithm.

Uploaded by

deepeshharshan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

1) Polynomial Addition using Linked List

Definition: Polynomial addition is the process of adding two polynomials term by term based on
their exponents. Each polynomial is stored as a linked list where each node contains coefficient and
exponent.

Algorithm:
1. Create two linked lists for the polynomials.
2. Traverse both lists simultaneously.
3. If powers are equal → add coefficients.
4. If one power > other → copy that term to result.
5. Continue until both lists are empty.
6. Return the result polynomial list.

Example:
P1 = 3x² + 2x + 5
P2 = 4x² + x + 7
Result = 7x² + 3x + 12

2) Singly Linked List in Detail (Insertion & Deletion)


Definition: A singly linked list is a linear data structure in which each element is a node containing
data and a pointer to the next node.

Insertion:
- At beginning
- At end
- At given position

Deletion:
- From beginning
- From end
- At given position

Advantages: Dynamic size, efficient insertion/deletion compared to arrays.

3) List ADT Operations using Array


Definition: List Abstract Data Type (ADT) represents a collection of elements stored in sequential
order.

Operations:
- Insertion
- Deletion
- Traversal
- Searching
- Updating

Limitation: Fixed size due to array implementation.

4) Doubly Linked List in Detail


Definition: A doubly linked list is a linked list in which each node contains pointers to both its
previous and next node.

Structure: prev | data | next


Advantages:
- Supports forward and backward traversal
- Efficient insertion and deletion at both ends

5) Stack Operations using Array


Definition: A stack is a linear data structure following the LIFO (Last In First Out) principle.

Operations:
1. Push – Insert an element at the top.
2. Pop – Remove the top element.
3. Peek – Access the top element.

Implementation: Using array with a pointer 'top'.

6) Radix Sort along with Problems


Definition: Radix Sort is a non-comparative integer sorting algorithm. It sorts numbers digit by digit
using a stable sort like Counting Sort.

Algorithm:
1. Find maximum number to determine number of digits.
2. Sort numbers digit by digit starting from least significant digit.
3. Use counting sort as subroutine.

Complexity: O(nk), where n = number of elements, k = number of digits.

Example: Sort [170, 45, 75, 90, 802, 24, 2, 66] → [2, 24, 45, 66, 75, 90, 170, 802]

7) Circular Queue (Array & Linked List)


Definition: A circular queue is a linear data structure in which the last position is connected back to
the first to form a circle.

Array Implementation: Uses modulo arithmetic: (rear+1) % size == front indicates queue full.

Linked List Implementation: Last node points to first node.

Applications: CPU scheduling, buffering in networks.

8) Binary Search Tree in Detail


Definition: A binary search tree (BST) is a binary tree in which for each node, left child < root <
right child.

Operations:
- Insertion
- Deletion
- Searching
- Traversals

Applications: Searching, sorting, symbol table, indexing.

9) Outline Preorder, Inorder, Postorder Traversals


Preorder: Root → Left → Right
Inorder: Left → Root → Right
Postorder: Left → Right → Root

Example Tree:
1
/\
23
/\
45

Preorder = 1,2,4,5,3
Inorder = 4,2,5,1,3
Postorder = 4,5,2,3,1

10) Infix, Postfix Conversions & Evaluation of Postfix Expression


Conversion: Infix → Postfix using stack.

Example: Infix (A + B * C) → Postfix (ABC*+)

Postfix Evaluation:
1. Scan expression left to right.
2. Push operands into stack.
3. When operator appears, pop required operands, apply operation, push result.

Example: Postfix 23*5+ = (2*3)+5 = 11

11) DEQUE (Double Ended Queue) in Detail


Definition: DEQUE is a linear data structure that allows insertion and deletion from both ends.

Types:
- Input restricted DEQUE: Insertion only at one end.
- Output restricted DEQUE: Deletion only at one end.

Applications: Scheduling, palindrome checking, sliding window problems.

You might also like