728x90 반응형 tree width1 트리의 너비(Tree Width) References 아래 링크의 강의 중 Section 26. Tree Width with Level Width의 내용을 추려 이번 글을 작성하였습니다. The Coding Interview Bootcamp: Algorithms + Data Structures on Udemy Tree Width function levelWidth(root) { const arr = [root, "s"]; const widths = [0]; while (arr.length > 1) { const node = arr.shift(); if (node === "s") { widths.push(0); arr.push("s"); } else { arr.push(...node.children); widths[widths.length.. 2022. 4. 5. 이전 1 다음 728x90 반응형