All Flashcards
What are the differences between linear and binary search?
Linear: Checks each element sequentially, works on unsorted data | Binary: Requires sorted data, eliminates half the data with each step.
What are the differences between parameters and arguments?
Parameters: Variables in procedure definition | Arguments: Values passed when calling the procedure.
What are the differences between reasonable and unreasonable time complexity?
Reasonable: Polynomial or lower | Unreasonable: Exponential or factorial.
What are the differences between decidable and undecidable problems?
Decidable: An algorithm can always find a solution | Undecidable: No algorithm can always find a solution.
How are random values applied in real-world scenarios?
Simulations, games, cryptography.
How are simulations applied in real-world scenarios?
Modeling weather patterns, traffic flow, or economic systems.
How are libraries applied in real-world scenarios?
Providing pre-built functions for tasks like image processing or data analysis.
What are the steps of binary search?
- Sort the data. 2. Find the middle element. 3. Compare target to middle. 4. Eliminate half the data. 5. Repeat until found or exhausted.