A linear search is performed on an array of 1,000 elements to find a value that is not present in the data. How many comparisons will the algorithm perform?
AQA A Level · Computer Science 7517
Searching algorithms:練習問題
その場で採点される選択問題 5 問と、解説つきの記述問題 5 問。すべて「Searching algorithms」からの出題です。
An array contains 2,048 sorted integers. In the worst-case scenario, how many comparisons will a binary search algorithm perform to determine if a value is in the array?
A programmer is choosing between a Binary Search and a Binary Tree Search for a system where the data is frequently updated with new items. What is a key disadvantage of the Binary Tree Search compared to the standard Binary Search in this specific context?
A programmer is searching for a value in a sorted array using the binary search algorithm. If the array contains 1,000,000 elements, what is the maximum number of comparisons required to find the target or determine it is not present?
A binary search tree (BST) contains \(n\) nodes. In the worst-case scenario, what is the time complexity of searching for a specific key if the tree is not balanced?
An algorithm is designed to find the shortest path between two points on a map represented as an unweighted graph. Identify which graph-traversal algorithm is most appropriate and state its Big-O time complexity if the graph has \(V\) vertices and \(E\) edges.
まず自分で答えを書いてから、解説と照らし合わせましょう。
A programmer needs to locate a specific integer in a sorted array containing 1,024 elements. Explain why a binary search is significantly more efficient than a linear search in the worst-case scenario for this dataset.
まず自分で答えを書いてから、解説と照らし合わせましょう。
A binary search tree (BST) is used to store \(n\) elements. Explain the conditions under which the search time complexity would degrade from \(O(\log n)\) to \(O(n)\).
まず自分で答えを書いてから、解説と照らし合わせましょう。
Consider the following list of sorted names: [Alice, Bob, Charlie, David, Edward, Fiona, George].
(a) Trace the steps of a binary search to find the name 'Fiona'. Identify the middle element chosen at each step.
(b) What is the maximum number of comparisons needed for a binary search on a list of 128 elements?
まず自分で答えを書いてから、解説と照らし合わせましょう。
Evaluate the efficiency of searching in a Binary Search Tree (BST) compared to a Binary Search on a sorted array.
(a) Under what condition does the time complexity of a BST search degrade from \(O(\log n)\) to \(O(n)\)?
(b) Describe how tree-traversal can be used to re-balance a tree to maintain \(O(\log n)\) performance.
まず自分で答えを書いてから、解説と照らし合わせましょう。
※ thinkaのコンテンツはAIにより生成されているため、内容が正確でない場合があります。補助教材としてご使用いただき、公式の教材と合わせてご確認ください。
模範解答は見ました。次はあなたの答案を採点します。
このページは良い答案の形を示せますが、あなたの答案に何が足りないかは教えられません。thinka は実際の採点基準に沿って記述答案を約 15 秒で採点します。
同じような問題をもっと解きたい?このトピックの新しい問題を、解きながら採点。
練習を始める