Questão 41 Comentada - Instituto Federal de Educação, Ciência e Tecnologia do Espírito Santo (IF-ES) - Técnico de Laboratório Área Informática - IF-ES (2025)

Considere o código de uma árvore implementado na linguagem Javascript, descrito a seguir:

class TreeNode {         constructor(value) {                 this.value = value;                 this.children = [];         }         addChild(child) {                 this.children.push(child); } } class Tree {         constructor(value) {                 this.root = new TreeNode(value); }
        compute(value) {                 if (!this.root) return null;                 const queue = [this.root];                 while (queue.length > 0) {                         const current = queue.shift();                         if (current.value === value) {                         return current;                         }                         for (const child of current.children) {                         queue.push(child);                         }                 }                 return null;         } }

O método compute do código é conhecido pelo acrônimo em inglês:

  • A DFS - Depth-First Search.
  • B BFS - Breadth-First Search.
  • C DAS - Directed Acyclic Search.
  • D MST - Minimum Spanning Tree.
  • E MBM - Maximum Bipartite Matching.