What is the time complexity of the bubble sort algorithm?
- O(log n)
- O(n!)
- O(n)
- O(n^2)
Bubble sort has a time complexity of O(n^2) in the worst-case scenario. This means that for every element in the array, it may need to compare it with every other element, leading to a quadratic growth in time complexity as the input size increases.
Loading...
Related Quiz
- The command "git ___________" is used to create a new branch in Git.
- What is synchronization in operating systems?
- Compare and contrast the component architecture of React and Angular.
- What is the purpose of MAC filtering in wireless networks?
- What are the key features of a Secure Sockets Layer (SSL) certificate?