전체 글
-
03/31 BinaryTree 전위, 중위, 후위 순회 출력자료구조/수업내용 2021. 3. 31. 17:22
Program.cs using System; namespace Study09 { class Program { static void Main(string[] args) { Console.WriteLine("Main"); new App(); } } } App.cs using System; namespace Study09 { public class App { //생성자 public App() { Console.WriteLine("App"); BinaryTree tree = new BinaryTree("A"); tree.root.left = new BinaryNode("B"); tree.root.right = new BinaryNode("C"); tree.root.left.left = new BinaryNode..
-
03/31 BinaryTree 배열로 구현하기자료구조/수업내용 2021. 3. 31. 15:57
배열로 이진트리 레벨 순으로 왼쪽에서 오른쪽으로 저장 A[0]는 루트노드 왼쪽추가(부모인덱스, 데이터) 왼쪽노드 계산 : (부모인덱스 * 2) + 1 계산한 인덱스에 데이터 추가 오른쪽추가(부모인덱스, 데이터) 오른쪽노드 계산 : (부모인덱스 * 2) + 1 계산한 인덱스에 데이터 추가 Program.cs using System; namespace Study09 { class Program { static void Main(string[] args) { Console.WriteLine("Main"); new App(); } } } App.cs using System; namespace Study09 { public class App { //생성자 public App() { Console.WriteLine..
-
03/30 수업내용 메모자료구조/수업내용 2021. 3. 30. 18:21
2021/03/30 큐 도착한 순서대로 데이터를 꺼내는 선형적 자료구조 선입선출구조를 가지고있음(FIFO) Front, Rear인덱스 배열을 이용한 큐 추가할 때는 Rear인덱스, 제거할때는 Front인덱스 사용 1. 큐의 초기 상태에서 Front와 Rear인덱스는 -1로 설정 2. 처음 추가시, A[0]에 넣고 Front와 Rear를 0 3. (Rear + 1)%A.length ==Front -> 가득 차있는지 확인 4. Front와 Rear가 -1 -> 비어있음 단일 연결 리스트를 이용한 큐 Head와 Tail을 갖게 하고, Tail을 통해 Enqueue하고, Head를 통해 Dequeue 스택 선형적인 자료구조, LIFO top에 데이터를 추가 push, pop 배열로 구현한 stack 고정배열, ..
-
03/30 단일 연결 리스트로 Stack 구현자료구조/수업내용 2021. 3. 30. 15:23
Program.cs using System; namespace Study09 { class Program { static void Main(string[] args) { Console.WriteLine("Main"); new App(); } } } App.cs using System; namespace Study09 { public class App { //생성자 public App() { Console.WriteLine("App"); StackLinkedList stack = new StackLinkedList(); Console.WriteLine("----------- Push ----------------"); stack.Push("장검"); stack.Push("단검"); stack.Push("활..
-
03/30 고정배열로 Stack 구현하기자료구조/수업내용 2021. 3. 30. 14:14
Stack에 필요한 Push, Pop, Peek메서드를 구현 Program.cs using System; namespace Study09 { class Program { static void Main(string[] args) { Console.WriteLine("Main"); new App(); } } } StackArray.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Study09 { public class StackArray { private int top; private string[] arr; public boo..
-
03/30 단일연결리스트 복습 Add, Count, Print자료구조/수업내용 2021. 3. 30. 10:12
단일 연결리스트의 노드 추가, 노드 갯수 취득, 노드 출력 기능 구현 Program.cs using System; namespace Study09 { class Program { static void Main(string[] args) { Console.WriteLine("Main"); new App(); } } } App.cs using System; namespace Study09 { public class App { //생성자 public App() { SingleLinkedList linkedList = new SingleLinkedList(); Node node1 = new Node(1); Node node2 = new Node(2); Node node3 = new Node(3); Node no..
-
03/29 Thread 복습 3 (상태)C#/수업내용 2021. 3. 29. 23:49
스레드의 Name속성에 이름을 설정하거나 가져올 수 있다. 스레드의 ThreadState속성으로 스레드의 동작 상태를 가져올 수 있다. Program.cs namespace Study07 { class Program { static void Main(string[] args) { new App(); } } } App.cs using System; using System.Threading; namespace Study07 { public class App { Thread thread1; Thread thread2; public App() { thread1 = new Thread(() => { //Running : 스레드 시작후 동작 상태 Console.WriteLine(thread1.ThreadState)..
-
03/29 Thread 복습 2 (Abort)C#/수업내용 2021. 3. 29. 22:53
Abort()메서드를 사용하는것으로 ThreadAbortException를 발생시켜 스레드 종료 프로세스를 시작 Program.cs namespace Study07 { class Program { static void Main(string[] args) { new App(); } } } App.cs using System; using System.Threading; namespace Study07 { public class App { public App() { Console.WriteLine("App"); Thread t = new Thread(new ThreadStart(this.TestThread)); t.Start(); Thread.Sleep(3000); t.Abort("Information fro..