Standard algorithms
הוצג
9:16
מחזור חיי פיתוח התוכנה
כל אפליקציה בטלפון שלך נכתבה על ידי מישהו כמו זה. אך הם לא התחילו בקלידת קוד. לפני השורה הראשונה, הבעיה נחקרה, הפתרון…
קריינות באנגלית · כתוביות באנגלית ובסינית 中文 שאפשר להחליף ביניהן
בשיעור הזה
| English | משמעות |
|---|---|
| algorithms/ˈælɡərɪθəmz/ | A finite sequence of precise steps for solving a problem or carrying out a task. |
| linear search/ˈlɪnɪə sɜːtʃ/ | חיפוש ליניארי |
| bubble sort/ˈbʌbl sɔːt/ | מיון בועות |
| counting/ˈkaʊntɪŋ/ | ספירה |
| totalling/ˈtəʊtəlɪŋ/ | סיכום |
| value/ˈvæljuː/ | An amount, number or item assigned to a variable or expression, or held by a data object. |
| list/lɪst/ | |
| sorting/ˈsɔːtɪŋ/ | |
| max/min | |
| average/ˈævrɪdʒ/ | |
| loop/luːp/ | A structure that repeats a sequence of instructions. |
| pass/pæs/ | |
| ascending order |
המתכונות הקלאסיות
- כמה אלגוריתמים סטנדרטיים מופיעים שוב ושוב.
- עליך לדעת חיפוש ליניארי, סינון בועה, ודפוסי הספירה/החיבור.
- כל אחד מהם קצר, אך שווה זיהוי מידי.
חיפוש ליניארי
DECLARE Found : BOOLEAN
Found ← FALSE
FOR I ← 1 TO 10
IF List[I] = SearchValue
THEN
Found ← TRUE
ENDIF
NEXT I
OUTPUT Found
- חיפוש ליניארי בודק כל פריט בתורו, מהתחלה, עד למציאת הערך (או לגלישה לסוף).
- הוא עובד על כל רשימה — אין צורך בסידור.

תרשים זרימה לאלגוריתם סכום, המשתמש בסמלים הסטנדרטיים (תחילה/סוף, קלט/פלט, עיבוד, החלטה).

Standard algorithms
compare adjacent, swap if needed
Step through a bubble sort — compare neighbours and swap until everything is in order.
A linear search finds a value by:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Linear search examines items one by one until it finds the value or reaches the end.
הכרטיס הזה תוקן, לכן הוא מוצג באנגלית עד שהתרגום שלו יעודכן.
Bubble sort
FOR Pass ← 1 TO 9
FOR I ← 0 TO 8
IF List[I] > List[I + 1]
THEN
Temp ← List[I]
List[I] ← List[I + 1]
List[I + 1] ← Temp
ENDIF
NEXT I
NEXT Pass
- A bubble sort 冒泡排序 compares each side-by-side pair and swaps them if they are out of order.
- It repeats this until no more swaps are needed — leaving the list sorted.

A bubble sort puts a list in order by:
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
It swaps out-of-order neighbours and repeats passes until no swaps are needed.
סיכום, ספירה, מקסימום/מינימום/ממוצע
- סיכום — שמירת סכום מצטבר:
Total ← Total + Value. - ספירה — הוסף 1 בכל פעם שדבר כלשהו קורה:
Count ← Count + 1. - מקסימום/מינימום — שמירת הערך הגדול ביותר/הקטן ביותר שנצפה עד כה.
- ממוצע — חלוקת הסכום במספר הערכים.

Which line adds a value to a running total?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Total ← Total + Value accumulates a sum; Count ← Count + 1 counts occurrences.
Match each standard algorithm to how it works.
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
These four — search, sort, total and max — are the building blocks of most exam algorithms.
Using totalling on the list [2, 4, 6, 8], what is the final total?
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
2 + 4 + 6 + 8 = 20.
הבנתך מושלמת
- חיפוש ליניארי בודק כל פריט בתור (עובד על כל רשימה).
- מיון בועות מחליף שכנים לא-סדורים, וחוזר על כך עד לסידור.
- סיכום (
Total ← Total + Value) ו-ספירה (Count ← Count + 1). - מקסימום/מינימום = שמירת הטוב ביותר עד כה; ממוצע = סכום ÷ ספירה.
A linear search looks for 7 in the list 4 9 2 7 5. How many items does it compare before it finds 7, including 7 itself?
רמת קושי 2/5 · 140 מטבעות + בונוס קטן בהשלמה הראשונה היום
It checks 4, 9, 2, then 7: four comparisons.
A program has totalled 5 marks to get 340. What is the average?
רמת קושי 1/5 · 100 מטבעות + בונוס קטן בהשלמה הראשונה היום
Average = total ÷ count = 340 ÷ 5 = 68.
הכרטיס הזה חדש, לכן הוא מוצג באנגלית עד שהתרגום שלו יהיה מוכן.
You've got it
- linear search checks each item in turn (works on any list)
- bubble sort swaps out-of-order neighbours, repeating until sorted
- totalling (
Total ← Total + Value) and counting (Count ← Count + 1) - max/min 最大值/最小值 = keep the best so far; average = total ÷ count
מה השתבש? רק צוות האתר רואה זאת.