Time Complexity Instructions Pseudocode 0 N J 0 J M J Sequence Statements Statements Chang Q37130861

  • What is the time complexity of the of the instructions in thepseudocode?

For (i = 0; I < N; i++) {

      for (j= 0; j < M; j++) {

     sequence of statements

     //statementsdo not change N or M

Answer: O(N*M) O(log N)O(n2) O(N)

  • Which sorting algorithm passes through the list swappingadjacent elements that are in reverse

Bubble Sort

  • Which sorting algorithm has a worst-case time complexity ofN*N

                                  Quick, Heap, Merge, Counting

  • Which sorting algorithm requires O(n) additional storage?

Quick, Merge, Radix, Shell

                                                          

  • Which sorting algorithm sorts into groups, witch then sortedindividually using a different sorting algorithm

Heap, Bucket, Linear, Quick.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.