An AVL tree is a self-balancing binary search tree where the _______ factor of each node is at most _______.

  • Balancing, 1
  • Degree, 2
  • Depth, 1
  • Height, 0
An AVL tree is a self-balancing binary search tree where the height factor (also known as the balance factor) of each node is at most 1. The balance factor is the difference between the height of the left and right subtrees.

DFS can be optimized by _______ the vertices in a particular order before traversal to achieve better performance.

  • Ordering
  • Randomizing
  • Shuffling
  • Sorting
DFS can be optimized by ordering the vertices in a particular way before traversal. The choice of vertex order can impact the algorithm's performance, and certain orders may result in a more efficient exploration of the graph.

Explain the role of topological sorting in scheduling tasks in project management.

  • Topological sorting helps in identifying the dependencies among tasks and establishes a valid order for task execution.
  • Topological sorting is not applicable in project management; it is only used in graph theory.
  • Topological sorting is used to sort tasks based on their completion times.
  • Topological sorting randomly assigns tasks without considering dependencies.
In project management, topological sorting plays a crucial role in scheduling tasks. It helps identify task dependencies and establishes a valid order for task execution, ensuring that tasks are completed in the correct sequence.

Suppose you are working on a genetic research project where you need to compare DNA sequences to identify common genetic patterns. Explain how LCS can be applied to this scenario and discuss any challenges you might encounter.

  • By comparing DNA sequences lengthwise.
  • By focusing only on specific nucleotide bases.
  • By identifying the longest common subsequence in DNA sequences.
  • By randomly aligning DNA sequences for comparison.
Applying LCS in genetic research involves identifying the longest common subsequence in DNA sequences, aiding in recognizing common genetic patterns. Challenges may include handling gaps, mutations, and variations in sequence length.

In a binary tree, what is the maximum number of children a node can have?

  • 1
  • 2
  • 3
  • 4
In a binary tree, each node can have a maximum of two children. This characteristic distinguishes binary trees from other tree structures and allows for efficient search and manipulation.

What is the significance of topological sorting in dependency resolution?

  • It helps in identifying isolated components in the graph.
  • It is used to compute the transitive closure of a graph.
  • It is used to find the maximum flow in a network.
  • It provides a linear order of tasks or events, allowing for systematic resolution of dependencies.
Topological sorting is significant in dependency resolution as it provides a linear order of tasks or events. This order ensures that tasks dependent on others are processed in the correct sequence, helping in the systematic resolution of dependencies.

How does the presence of cycles in a graph affect the possibility of performing topological sorting?

  • Cycles have no impact on topological sorting.
  • Cycles make topological sorting deterministic.
  • Cycles make topological sorting impossible.
  • Cycles make topological sorting more efficient.
The presence of cycles in a graph makes topological sorting impossible. Topological sorting is designed for directed acyclic graphs (DAGs), and cycles introduce ambiguity in the order of nodes, preventing a clear linear ordering of vertices.

You're designing a scheduling application where tasks are added and removed frequently. Would you use a singly linked list or a doubly linked list to implement the task list? Justify your choice.

  • Array
  • Circular linked list
  • Doubly linked list
  • Singly linked list
In this scenario, a doubly linked list would be a better choice. The reason is that tasks are added and removed frequently, and a doubly linked list allows for easy insertion and deletion of elements at both the beginning and end of the list, providing efficient operations for a scheduling application.

The optimal substructure property ensures that the solution to a subproblem can be used to solve the _______ problem.

  • Current
  • Larger
  • Original
  • Smaller
The optimal substructure property ensures that the solution to a subproblem can be used to solve the original, larger problem. It is a key property for dynamic programming algorithms to efficiently solve problems by breaking them down into smaller subproblems.

To optimize linear search, consider implementing techniques such as _______.

  • Divide and Conquer
  • Dynamic Programming and Backtracking
  • Hashing and Bucketing
  • Transposition and Move to Front
Techniques such as transposition and move to front can be implemented to optimize linear search. These techniques involve rearranging elements based on their access patterns, improving the chances of finding the target element early in subsequent searches.