Which of the following is a necessary condition that must be met before a binary search algorithm can be used on a list of data items?
Cambridge International A Level · Computer Science (9618)
Computational thinking and Problem-solving:練習問題
その場で採点される選択問題 2 問と、解説つきの記述問題 5 問。すべて「Computational thinking and Problem-solving」からの出題です。
Consider the following recursive pseudocode function:
FUNCTION Calculate(n)
IF n = 1 THEN
RETURN 1
ELSE
RETURN n + Calculate(n - 1)
END IF
END FUNCTION
What is the value returned by Calculate(4)?
State the Big O time complexity for finding a specific item in a sorted array containing \(n\) elements using binary search.
まず自分で答えを書いてから、解説と照らし合わせましょう。
A programmer uses a stack Abstract Data Type (ADT) to support undo functionality. Explain why a stack is the most suitable data structure for this purpose.
まず自分で答えを書いてから、解説と照らし合わせましょう。
Explain the role of the call stack during the execution of a recursive function, specifically stating what is stored during recursive calls and what occurs during the unwinding phase.
まず自分で答えを書いてから、解説と照らし合わせましょう。
(a) Stepwise refinement is a key technique in computational thinking. Explain the purpose of using stepwise refinement when designing a complex computer program.
(b) A programmer is designing an algorithm to calculate the total price of a customer's order. The algorithm takes the Unit Price and the Quantity of an item as input, calculates the Subtotal, applies a 10% discount if the Subtotal is over \( 100 \), and then outputs the Final Total.
Complete the following identifier table for this algorithm by providing the data types and descriptions for the four variables mentioned.
まず自分で答えを書いてから、解説と照らし合わせましょう。
A 1D array, MyList, contains 100 integer elements. A programmer needs to design an algorithm to search for a specific value, SearchValue, within this array.
(a) Write pseudocode for a linear search algorithm to find SearchValue in MyList. If the value is found, output its index position; otherwise, output a message stating the value was not found.
(b) Explain one reason why a linear search would be chosen over a binary search for this specific array.
まず自分で答えを書いてから、解説と照らし合わせましょう。
※ thinkaのコンテンツはAIにより生成されているため、内容が正確でない場合があります。補助教材としてご使用いただき、公式の教材と合わせてご確認ください。
模範解答は見ました。次はあなたの答案を採点します。
このページは良い答案の形を示せますが、あなたの答案に何が足りないかは教えられません。thinka は実際の採点基準に沿って記述答案を約 15 秒で採点します。
同じような問題をもっと解きたい?このトピックの新しい問題を、解きながら採点。
練習を始める