Cadernos de Questões

Provas Favoritas

Filtros Salvos

Foi encontrada 1 questão.
#3496825

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:

  • DFS -Depth-First Search.
  • BFS -Breadth-First Search.
  • DAS -Directed Acyclic Search.
  • MST -Minimum Spanning Tree.
  • MBM -Maximum Bipartite Matching.
Fale com IAgo
IAgo - Assistente IAProva
IA
Olá! Sou o IAgo, seu assistente aqui no IAProvatec 😊
Veja como posso te ajudar:
Agora