profile picture

Anonymous

upvote

0

downvote

0

star

Xác định độ phức tạp của thuật toán sắp xếp nổi bọt sau: def BubbleSort(A):

clock icon

- asked 6 months agoVotes

message

0Answers

eye

0Views

Giải Tin học 11 Bài 25: Thực hành xác định độ phức tạp thời gian thuật toán

Luyện tập 1 trang 117 Tin học 11: Xác định độ phức tạp của thuật toán sắp xếp nổi bọt sau:

def BubbleSort(A):

n = len(A)

for i in range(n-1):

 for j in range(n-1-i):

  if A[j] > A[j+1]:

   A[j],A[j+1] = A[j+1]1,A[j]

Lời giải:

Độ phức tạp của thuật toán sắp xếp nổi bọt là O(n2)

T=O(n)+O(n2)=O(n2)

Bài tập liên quan

Write your answer here

© 2025 Pitomath. All rights reserved.