Highlighted text? Practice this concept. Highlighted passages and figures open related questions.
Practice related questions (1)Progress & bookmarks
Current section
2-2-4 Computational Complexity
p. 425
Progress
Not marked complete
Related questions in this lesson 1
Time orders of three search methods1p. 425 · PDF 435
2-2-4 Computational Complexity
Computational complexity is one of the indicators for evaluating algorithms. There is time complexity which shows the increase in processing time according to the amount of data to be processed, and space complexity which shows the increase in the use of memory space. The notation system of computational complexity includes big O notation which shows the upper limit of computational complexity of an algorithm with O (i.e., order). In the big O notation, if computational complexity of the part that has the maximum impact on the overall is proportional to data number N, it is represented as O(N). If it is proportional to the square of N, it is represented as O(N2). The computational complexity (e.g., time complexity) for three search algorithms is compared. In a search algorithm, a comparison process (decision process) is repeated until the target value is found. Therefore, the number of comparisons (i.e., number of searches) decides the processing time of the algorithm (or the implemented program). The following is the number of comparisons made in each search algorithm for N data items that are covered in the search.

Original source text
Minimum number
Maximum number
Average number of
of comparisons
of comparisons
comparisons
Linear search
1 time
N times
“N ÷ 2” times
Binary search
1 time
“[log2N] + 1” times
[log2N] times
1 time
Hash search
1 time
“1 + α” times
(See note below.)
• [x] that is referred to as Gauss symbol shows means the greatest integer that is less
Source visual description
Original Computational Complexity source layout. Source labels: Minimum number; of comparisons; Maximum number; of comparisons; Average number of.
p. 426 · PDF 436
than or equal to x.
- • log2N shows x for which 2x = N (e.g., log216 = 4).
Note: This is the case the storage location (i.e., hash value) is approximated with uniform distribution, and in addition, the probability of occurrence of a synonym is so small that it can be ignored.

Original source text
Example: When the number of data has increased from 100 to 200, by how many times
does the average number of comparisons increase for a linear search and a binary search,
respectively?
• Increase in the average number of comparisons of linear search
= Average number of comparisons of 200 data items
− Average number of comparisons of 100 data items
= (200 ÷ 2) times − (100 ÷ 2) times = 100 times − 50 times = 50 times
• Increase in the average number of comparisons of binary search
= Average number of comparisons of 200 data items
− Average number of comparisons of 100 data items
= [log2200] times − [log2100] times = 7 times − 6 times = 1 time
Source visual description
Original Computational Complexity source layout. Source labels: Example: When the number of data has increased from 100 to 200, by how many times; does the average number of comparisons increase for a linear search and a binary search,; respectively?; • Increase in the average number of comparisons of linear search; = Average number of comparisons of 200 data items.
Section progress
Original chapter exercises
Original chapter exercises →New FE Textbook Vol.1 · IT Fundamentals · First Edition, April 2015