Manacher's Algorithm is able to achieve linear time complexity by exploiting the _______ of palindromes.

  • Boundaries
  • Linearity
  • Reversibility
  • Symmetry
Manacher's Algorithm exploits the symmetry of palindromes to achieve linear time complexity. It cleverly uses information from previously processed characters to avoid redundant computations, making it an efficient algorithm for finding palindromic substrings.

What is the key characteristic of an AVL tree that distinguishes it from a regular binary search tree?

  • It allows nodes to have more than two children.
  • It arranges nodes in a way that minimizes the height of the tree.
  • It ensures the tree remains balanced by performing rotations after insertions or deletions.
  • It stores elements in a way that allows for efficient hashing.
The key characteristic of an AVL tree is that it arranges nodes in a way that minimizes the height of the tree, ensuring it remains balanced and maintains efficient search operations. This is achieved by performing rotations after insertions or deletions.

Consider a scenario where you need to store a massive amount of log data generated by IoT devices in a cloud-based storage system. Discuss the challenges and potential solutions for applying string compression to reduce storage costs and improve data retrieval efficiency.

  • Address the challenge of dynamic data by using adaptive compression techniques, which adjust to varying data patterns and achieve efficient compression ratios.
  • Apply lossy compression selectively to log data fields that can tolerate data loss, optimizing storage space while preserving critical information.
  • Implement static dictionary-based compression to ensure consistent compression ratios, facilitating predictable storage costs.
  • Utilize a combination of encryption and compression algorithms to secure log data during storage and transmission.
In this scenario, addressing the challenge of dynamic data with adaptive compression techniques is crucial. Adaptive compression adjusts to varying data patterns in IoT log data, providing efficient compression ratios and accommodating the evolving nature of the data generated by IoT devices.

Describe the role of exception handling in stack operations.

  • Exception handling is limited to memory-related issues only.
  • Exception handling is not applicable to stack operations.
  • Exception handling is used to terminate the program if a stack operation fails.
  • It helps manage errors that may occur during stack operations, ensuring proper program execution.
Exception handling in stack operations is crucial for managing errors that may occur, such as stack overflow or underflow. It allows the program to gracefully handle these situations, preventing unexpected crashes and ensuring robustness in stack-related functionality.

The time complexity of BFS when implemented on an adjacency list representation of a graph is _______.

  • O(E)
  • O(V + E)
  • O(V)
  • O(log V)
The time complexity of BFS (Breadth-First Search) when implemented on an adjacency list representation of a graph is O(V + E), where V is the number of vertices and E is the number of edges. This is because each vertex and edge are examined once during the traversal.

How does merge sort handle sorting of linked lists?

  • Merge sort can efficiently sort linked lists
  • Merge sort can only be used for arrays
  • Merge sort cannot be used for linked lists
  • Merge sort requires additional memory
Merge sort can efficiently handle the sorting of linked lists. Unlike array-based sorting algorithms, merge sort's divide-and-conquer approach is well-suited for linked lists as it involves splitting and merging without the need for random access to elements. This makes it a preferred choice for sorting linked structures.

What is the time complexity of merge sort in the worst-case scenario?

  • O(log n)
  • O(n log n)
  • O(n)
  • O(n^2)
The time complexity of merge sort in the worst-case scenario is O(n log n), making it an efficient algorithm for sorting large datasets. This complexity arises from its divide-and-conquer approach.

BFS guarantees finding the shortest path in an unweighted graph due to its _______ approach.

  • Breadth-First
  • Dynamic
  • Greedy
  • Systematic
BFS guarantees finding the shortest path in an unweighted graph due to its Breadth-First approach. This means it explores all nodes at the current depth before moving on to nodes at the next depth level, ensuring that the shortest path is found first.

In real-world applications, finding the LCS is crucial for tasks such as _______ and _______.

  • Genome sequencing, Version control
  • Image recognition, Speech processing
  • Pattern matching, Data compression
  • Text summarization, Machine translation
Finding the Longest Common Subsequence (LCS) has significant applications in tasks such as genome sequencing, where identifying common elements in sequences is vital, and version control systems, where it helps track changes in code or documents.

In selection sort, how many comparisons are performed in the inner loop in each iteration?

  • i
  • n
  • n - 1
  • n - i
In each iteration of the inner loop in selection sort, where 'i' is the current iteration, n - i comparisons are performed. This is because the inner loop looks for the minimum element in the unsorted portion and places it at the beginning, reducing the number of comparisons in subsequent iterations.