Putting it together
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · 이 페이지는 최신 브라우저(SharedArrayBuffer 지원)가 필요합니다. Chrome, Edge, Firefox 또는 Safari를 최신 버전으로 업데이트해 주세요.
English
Putting it together
- A real algorithm joins the pieces: arrays, loops and selection.
- The exam's standard methods are totalling, counting, linear search, and finding the maximum or minimum.
한국어
통합하기
- 실제 알고리즘은 배열, 루프 및 선택 요소를 결합합니다.
- 시험의 표준 방법은 합계 계산, 카운팅, 선형 탐색, 최대값 또는 최소값 찾기입니다.
DECLARE A : ARRAY[1:5] OF INTEGER
DECLARE I, Total : INTEGER
FOR I ← 1 TO 5
A[I] ← I * 10
NEXT I
Total ← 0
FOR I ← 1 TO 5
Total ← Total + A[I]
NEXT I
OUTPUT Total
Explore · 탐색하기
Totalling an array
Totalling — start at 0, then add each array item as the loop visits it.
English
Searching and counting
- Linear search: check each item, and set a flag if you find the target.
- Counting: add 1 to a counter each time a rule is true.
한국어
탐색 및 카운팅
- 선형 탐색: 각 항목을 확인하고 타겟을 찾으면 플래그를 설정하십시오.
- 카운팅: 규칙이 참일 때마다 카운터에 1을 추가하십시오.
DECLARE A : ARRAY[1:5] OF INTEGER
DECLARE I, Target : INTEGER
DECLARE Found : BOOLEAN
FOR I ← 1 TO 5
A[I] ← I * 10
NEXT I
Target ← 30
Found ← FALSE
FOR I ← 1 TO 5
IF A[I] = Target
THEN
Found ← TRUE
ENDIF
NEXT I
OUTPUT Found
English
Common mistakes
- Plan the structure before you write the pseudocode.
- Match the exam's keywords and layout exactly.
한국어
흔한 실수
- 가짜코드(pseudocode)를 쓰기 전에 구조를 먼저 계획하십시오.
- 시험의 키워드와 형식을 정확히 맞추십시오.
English
Now you try
- Each task uses an array that is filled for you — write the algorithm.
- Press Check answer to test it.
한국어
이제 직접 해보기
- 각 과제는 이미 채워진 배열을 사용하므로, 알고리즘만 작성하십시오.
- 답안 확인을 눌러 테스트해 보십시오.
The array A is filled for you. Total all 5 values and output Total = then the total (it is 25).
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.
The array A is filled for you. Use a linear search to set Found to TRUE if 9 is in the array, then output Found.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.
The array A is filled for you. Count how many values are greater than 4, then output the count (it is 3).
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.