• edited by
37 views
1 1 vote

A logistics company manages a tracking system where each package ID is stored in a chronological list as the packages are processed. An engineer suggests that, to locate a particular package's ID, the system should check each ID sequentially from the start until the target is found or the list ends. Which statement most accurately reflects the main drawback of this approach if the company expects the number of packages to increase dramatically over time?

  1. The memory needed to store package IDs will remain constant even as the list grows.
  2. Finding a package ID will become faster as the number of packages increases.
  3. The time to search for any package ID will stay about the same, regardless of list size.
  4. Search time grows linearly with the number of packages.

1 Answer

0 0 votes
  • Option A: Incorrect. Memory grows linearly $O(n)$ with the number of package IDs stored, not remaining constant $O(1)$.

  • Option B: Incorrect. Search time increases, rather than becoming faster, as the list grows.

  • Option C: Incorrect. This describes constant time $O(1)$, which is characteristic of Hash Table lookups, not linear search.

  • Option D (CORRECT): Search time grows linearly with the number of packages.

    • In Linear Search, the worst-case time complexity is $\mathcal{O}(n)$, where $n$ is the total number of packages.

    • If the number of packages increases dramatically from $1,000$ to $1,000,000$, the worst-case comparison count increases directly from $1,000$ to $1,000,000$.

    • so option.  D  is correct. 

Position:
Show:

Related questions

1 1 vote
0 0 answers
23
23 views
Shubham Sharma 2 asked Sep 15
23 views
What is the initial value of top in an empty stack implemented using an array?$0$$-1$$1$Depends on stack size
0 0 votes
0 0 answers
16
16 views
Shubham Sharma 2 asked Sep 15
16 views
A banking transaction commits successfully, but a system crash occurs immediately afterward. Which mechanism ensures durability?LockingPartial commitTransaction isolation...
0 0 votes
0 0 answers
18
18 views
Shubham Sharma 2 asked Sep 15
18 views
Consider a finite state transducer (FST) with $Q=\left\{q_{0}, q_{1}\right\}, \Sigma=\{0,1\}, \Gamma=\{a, b$, $\mathrm{c}\}$, initial state $\mathrm{q}_{0}$, and the foll...
1 1 vote
0 0 answers
17
17 views
Shubham Sharma 2 asked Sep 15
17 views
In a memory system with fixed-sized partitions, each holding one process (as in IBM OS$/360$ MFT).Which statement is correct?Multiprogramming limited; internal fragmentat...