What is the time complexity of a C++ program with a nested for-loop?
- 0(N²)
- O(N)
- O(log N)
- None of these
Explanation
In a nested for-loop, the inner loop executes N times for each iteration of the outer loop.
This results in a total of N × N = N² iterations, making the time complexity O(N²).
Related MCQs
فِشنگ کیا ہے؟
- A method of encrypting data for security
- Cybercrime involving fraudulent emails or messages to obtain sensitive information
- A technique to speed up network connections
- A way to block access to websites
اس سوال کو وضاحت کے ساتھ پڑھیں
کمپیوٹر نیٹ ورکس میں فائر وال کا بنیادی کام کیا ہے؟
- To prevent/block unauthorized access
- To block viruses
- To speed up network traffic
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
فارن کی کیا ہوتی ہے؟
- A key that uniquely identifies a record in the same table
- A key used to delete records
- A field in one table that refers to the primary key of another table
- A password for database security
اس سوال کو وضاحت کے ساتھ پڑھیں
کمپائلر کیا ہے؟
- Name given to the computer operator
- Translator of source program to object / Translator of high-level program to machine
- Part of the digital machine to store the information
- None of these
اس سوال کو وضاحت کے ساتھ پڑھیں
کیش میموری کہاں موجود ہوتی ہے؟
- CPU
- Software
- Window
- None of these