본문 바로가기
반응형

전체 글207

[자바기초.030] Sorting Algorithms [자바기초.030] Sorting Algorithms 데이터를 정렬하는 알고리즘은 아주 많습니다. 이곳에서 다룰 정렬 알고리즘은 Selection, Insertion, Merge 정렬 알고리즘 입니다. 1.Selection Sort 선택 정렬(selection sort)은 제자리 정렬 알고리즘의 하나로, 다음과 같은 순서로 이루어진다. 1.주어진 리스트 중에 최소값을 찾는다. 2.그 값을 맨 앞에 위치한 값과 교체한다(패스(pass)). 3.맨 처음 위치를 뺀 나머지 리스트를 같은 방법으로 교체한다. n개의 주어진 데이터를 이와 같은 방법으로 정렬하는 데에는 Θ(n^2) 만큼의 시간이 걸린다.(이중 for문) 좀 더 자세히 설명하면, Selection Sort(선택 정렬)는 첫 번째 데이터를 두 번째 데.. 2024. 3. 30.
[자바기초.029]Searching Algorithms [자바기초.029]Searching Algorithms 1.Search Algorithm 컴퓨터는 많은 양의 데이터를 메모리에 저장하고 원하는 데이터를 빠르게 찾아내는 역할을 합니다. 그 중에서 데이터를 찾아내는 일을 "탐색(Searching)"이라고 말합니다. 가장 대표적인 Searching 방법인 Sequential(Linear) Search와 Binary Search 알고리즘에 대해 알아봅시다. 2.Sequential Search(Linear Search) Sequential Search = Linear Search = 순차 탐색 Sequential Search는 데이터를 처음부터 끝까지 차례대로 비교하여 원하는 데이터를 찾아내는 알고리즘 입니다. Sequential Search는 정렬되지 않은 데.. 2024. 3. 30.
APCSA Mock Test APCSA Mock Test -Mock Test (1) link: https://vo.la/vlsqd -Mock Test (2) link: https://vo.la/bHyeQ -Mock Test (3) link: https://vo.la/cWnxf -Mock Test (4) link: https://vo.la/IkCne -Mock Test (5) link: https://vo.la/NhlYl -Mock Test (6) link: https://vo.la/XUvSl (Timed test below;) -Mock Test (7) link: https://vo.la/LPIuq -Mock Test (8) link: https://vo.la/axuCw -Mock Test (9) link: https://vo.la.. 2024. 3. 29.
[자바AP연습문제] 10.Recursion [자바AP연습문제] 10.Recursion *10.Recursion 단원의 복습내용은 아래 "더보기" 클릭 더보기 In this unit you learned about recursion. A recursive method calls itself (contains a call to the method from inside of the method). A recursive method should have at least one way to stop the recursion. This is called a base case. base case - A way to stop the recursive calls. This is a return without a recursive call. call stack -.. 2024. 3. 29.
[자바AP연습문제] 09.Inheritance [자바AP연습문제] 09.Inheritance *09.Inheritance 단원의 복습내용은 아래 "더보기" 클릭 더보기 In this chapter you learned about inheritance. In an object-oriented program you write classes that define what objects of each class know (instance variables) and can do (methods). One class can inherit object instance variables and methods from another, which makes the amount of code that you have to write smaller and makes th.. 2024. 3. 29.
[자바AP연습문제]08.2D Arrays [자바AP연습문제] 08. 2D Arrays *08.2D Arryas 단원의 복습내용은 아래 "더보기" 클릭 더보기 In this chapter you learned about two dimensional arrays. A two dimensional array stores objects in a 2d table. You can think of it as storing objects in rows and columns, but it actually uses an array of arrays to store the objects as shown below. In this chapter you learned how to declare 2d arrays, create them, and access array .. 2024. 3. 29.
[자바AP연습문제] 07.ArrayList [자바AP연습문제] 07.ArrayList *07.ArrayList 단원의 복습내용은 아래 "더보기" 클릭 더보기 In this chapter you learned about ArrayLists which are dynamic re-sizable arrays. You learned how to declare and create ArrayLists, add and remove objects from them, set the object at an index, and get the object at an index. List are like arrays in that you can store many objects of the same type in a list, just as you can in an ar.. 2024. 3. 29.
[자바기초.028] for-each loop [자바기초.028] for-each loop 1.for-each 반복문(Enhanced for 반복문) 배열에 사용하면 좋을 for each loop(enhanced for loop)이 있습니다. for-each문은 그냥 일반적인 for문보다 사용하기 편합니다. for문의 index나 [ ] 괄호를 사용하지 않고 반복문 순회(traverse)를 할 수 있는게 for-each 문입니다. [예제1] 아래 코드는 String형, int 형 배열을 for-each loop으로 순회하며 요소값을 출력하는 코드입니다. HTML 삽입 미리보기할 수 없는 소스 for-each loop를 사용하면 배열의 첫 번째 요소(element)부터 마지막 요소까지 하나씩 자동적으로 접근할 수 있다. for-each loop를 사용.. 2024. 3. 29.
AP Computer Science A Java Quick Reference (3) Math Class AP Computer Science A Java Quick Reference (3) Math Class 자바에서 Math 클래스는 자바를 설치하면 포함되는 클래스로서, 이 클래스 안에 있는 메소드들은 static method이기 때문에 object를 만들지 않고 "클래스이름.메소드이름()" 방식으로 바로 사용가능합니다. Static methods (also called class methods) are called using the class name and the dot operator (.) followed by the method name. You do not need to create an object of the class to use them. You can use ClassName.metho.. 2024. 3. 28.
728x90
반응형