본문 바로가기

c#158

게임 알고리즘 시험 제출 유의 사항 FTP에 접속후 해당 능력단위평가 / 결과물 / 자신이름폴더를 생성후 ​ 1. README.txt파일을 반드시 첨부해주세요(메모장) 각문제를 해결했는지에 대한 여부와 함께 상세 설명을 적어주세요 ​ 2. 스크린샷 1장 이상일 제출해주세요(캡처) ​ 3. 실행 영상파일 1개이상 제출해주세요(오캠) ​ 4. 프로젝트폴더를 제출해주세요 (압축 절대 하지 말것) 프로젝트 이름은 제시되는 명으로 해주세요 예를들어 exam01 문제 마다 무엇을 구현하려고 했는지 생각을 적고, 이해하지 못한 것들은 왜 구현을 못했는지(000은 이해가 안간다)등 보는 사람이 이해하기 쉽도록 내가 하고자 하는 것을 상세하게 설명할 것.(메모장에) 코드는 잘 쓸 줄 몰라도 읽을 수는 있도록 종강까지 노력해야 함. 2021. 10. 4.
자료구조 그래프(가중치 그래프) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Helloworld1 { class Graph { public class Vertex { public string Data { get; private set; } public LinkedList neighbors; public LinkedList weights; public Vertex(string data) { this.neighbors = new LinkedList(); this.weights = new LinkedList(); this.Data = data; } } //정점들을.. 2021. 10. 1.
자료구조 그래프 그래프는 vertex와 edge로 구성된 한정된 자료구조를 의미한다. vertex는 정점, edge는 정점과 정점을 연결하는 간선이다. 2021. 10. 1.
자료구조 트리 이진트리(PreOrder) + 재귀함수 PreOrder 1.다이어그램 2.순서도 수정 수정 3.코드화 public void PreOrder() { if(this.Root == null) { throw new InvalidOperationException(""); } else { Console.Write("{0} ", this.Root.Data); if(this.Root.Left != null) { PreOrderRecursive(this.Root.Left); } else { if(this.Root.Right != null) { PreOrderRecursive(this.Root.Right); } } } } 재귀적 순서도 코드화 private void PreOrderRecursive(Node node) { Console.Write("{0} ", .. 2021. 9. 29.
자료구조 트리 - 이진트리(LevelOrder) -다이어그램, 순서도 수정후 -코드화 public void LevelOrder() { Queue q = new Queue(); q.Enqueue(this.Root); Node temp; if(this.Root == null) { throw new InvalidOperationException(""); } else { while (q.Count > 0) { temp = (Node)q.Dequeue(); if (temp.Left == null) { q.Enqueue(temp.Left); if (temp.Right == null) { q.Enqueue(temp.Right); } } } } } 2021. 9. 29.
자료구조 이진트리(배열) using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Helloworld1 { class BinaryTreeArr { public string[] arr; //생성자 public BinaryTreeArr(int data) { arr = new string[data]; } public void AddRoot(string data) { if(arr[0] == null) //루트가 비어있다면 { arr[0] = data; //루트 출력 } else { Console.WriteLine(""); } } public void AddLeft(int.. 2021. 9. 29.
자료구조 트리 순회LCRS (PreOrder, InOrder, PostOrder) + 재귀함수 -미완성 PreOrder 1.다이어그램 2.순서도 3.코드화 InOrder 1.다이어그램 2.순서도 3.코드화 PostOrder 1.다이어그램 2.순서도 3.코드화 2021. 9. 29.
자료구조 트리 순회LCRS (Level Order) 1.다이어그램 알고리즘 2.순서도 순서도 수정 3.코드화 public void LevelOrder() { Queue q = new Queue(); q.Enqueue(this.Root); Node temp; if(this.Root == null) { throw new InvalidOperationException(); } else { while (q.Count != 0) { temp = (Node)q.Dequeue(); Console.Write("{0} ", temp.Data); if (temp.Left == null) { q.Enqueue(temp.Left); if (temp.Left.Right == null) { q.Enqueue(temp.Left.Right); } } } } } 2021. 9. 27.
자료구조 트리(Tree) 정의, LCRS구현 https://ko.wikipedia.org/wiki/%ED%8A%B8%EB%A6%AC_%EA%B5%AC%EC%A1%B0 트리 구조 - 위키백과, 우리 모두의 백과사전 ko.wikipedia.org 트리 구조(tree) : 나무구조, 계층적 자료구조 그래프의 일종이다 그래프 (Graph) : vertex (정점)과 edge (간선)으로 이루어진 자료구조 ​ 서로 다른 두 노드를 잇는 길이 하나뿐인 그래프를 트리라고 부른다. ​ 트리에서 최상위 노드를 루트 노드(root node)라고 한다 ​ A가 B를 가리킬때 A를 B의 부모노드 (parent node), B를 A의 자식노드(child node) 라고한다 ​ 형제 노드(sibling node)는 부모가 같은 두 노드이다. ​ 자식 노드가 없는 노드를 잎.. 2021. 9. 24.
자료구조 Queue 복습연습 1.Enqueue using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Helloworld1 { class Queue { public Node tail; public Node head; public Queue() { } public void Enqueue(int data) { if(head == null) { head = new Node(data); tail = head; return; } else { tail.next = new Node(data); tail = tail.next; } } } } 2.Dequeue using Syste.. 2021. 9. 24.