- 트리 관련 용어 정리- 루트(Root) : 트리의 최상단 노드 간선(Edge) : 두 노드를 잇는 선 브랜치(Branch) : 한 노드에서 갈라져 나온 자식 노드의 수 형제(Sibling) : 부모가 같은 자식노드들 리프(Leaf) : 자식노드가 없는 하단의 노드 높이(Height) : 특정 노드에서 루트 사이의 길이 깊이(Depth) : 루트 노드에서 특정 노드까지의 길이 트리 높이(Tree Height) : 가장 먼 거리에 있는 Leaf 노드와 루트 사이의 길이 트리 깊이(Tree Depth) : 루트 노드에서 가장 먼 리프 노드까지의 길이 레벨(Level) : 루트 노드로부터의 깊이 노드의 차수(Node Degree) : 한 노드의 서브트리의 갯수(자식노드의 수) 트리의 차수(Tree Degre..
코드 using UnityEngine; using UnityEngine.UI; public class CheckButtonDirector : MonoBehaviour { public Toggle[] toggles; public void Awake() { this.toggles[0].isOn = false; this.toggles[1].isOn = false; } void Start() { for (int i = 0; i { Debug.LogFormat("{0} 의 토글 상태 : {1}", this.toggles[temp].name, x); }); } } } 구현 영상 토..
문제 코드 구현 using System; using System.Collections.Generic; namespace BFS { internal class Program { static int N = 7; static int[,] map = new int[N, N]; static string[] cities = { "서울", "대전", "대구", "부산", "광주", "천안", "공주", }; static int[] visited = new int[N]; static void Main(string[] args) { int[,] edges = { {0,1}, {0,2}, {1,3}, {1,4}, {2,5}, {2,6}, }; for (int i = 0; i < N - 1; i++) { int v1 = e..
문제 구현 App Class using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace study01 { internal class App { public App() { Inventory inventory = new Inventory(5); inventory.AddItem(new Weapon("장검")); inventory.PrintItem(); inventory.DeleteItem("장검"); inventory.PrintItem(); inventory.AddItem(new Weapon("장검")); inventory.PlusCapacity..
단검 직렬화 (객체를 문자열로) App Class using System; using System.Collections.Generic; using System.IO; using System.Linq; using Newtonsoft.Json; namespace Study11 { class App { //생성자 public App() { //객체를 만들고 직렬화 해서 JSON형식 (문자열) 파일로 저장 Item item = new Item("단검,",5); //직렬화 : 아이템 객체를 넣어 주면 json문자열을 반환 string json = JsonConvert.SerializeObject(item); Console.WriteLine(json); //저장 File.WriteAllText("dagger.jso..
App 클래스 using System; using System.Collections; using System.Collections.Generic; namespace Study09 { class App { public App() { Inventory inven = new Inventory(5); inven.AddItem(new Weapon("장검")); inven.AddItem(new Weapon("장검")); inven.AddItem(new Weapon("단검")); inven.AddItem(new Weapon("창")); inven.AddItem(new Weapon("단검")); Console.WriteLine(inven.Count); inven.PrintAllItems(); //장검 x 2 //단검 ..
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study08 { class Inventory { private int capacity; //최대 용량 private Item[] items; //아이템들을 관리 배열 int index; //생성자 public Inventory(int capacity) { this.capacity = capacity; //배열 초기화 this.items = new Item[this.capacity]; } public void AddItem(Item item) { for (int i = 0; i < ..