Q.17: What are the factors which affect the running time of an algorithm?
Answer:
factors affects the running time of an algorithm are
1. Parallelism – A multi-threaded program running on multicore machine will be faster.
2. CPU Utilization - If CPU is already utilized by some other processes then running time of algorithm will increase.
3. I/0 Bound – Sometimes I/O bounds like disk read/write speed affect the running time.
4. Overhead Due to many Function Call – There could be huge overhead on running if a function call is made multiple times for a small function.
5. Recursion – Recursion can cause a lot of overhead which increases the running time of an algorithm.
6. Disk Layout – For multiple disk, RAID might work best or faster than NAS, SAN or other storage layout.
7. Contention – If there are multiple threads, they are synchronized to access common resources, then there can be contention for the resources which causes thread to wait.
8. Buggy Synchronization - If there are deadlocks, the algorithm or program will stop working or the two threads involved in deadlock will stop. This increases running time of any algorithm.