100% de satisfacción garantizada Inmediatamente disponible después del pago Tanto en línea como en PDF No estas atado a nada
logo-home
WGU C949 - Searching and Sorting Algorithms Questions and Answers 100% Correct 12,33 €   Añadir al carrito

Examen

WGU C949 - Searching and Sorting Algorithms Questions and Answers 100% Correct

 5 vistas  0 veces vendidas
  • Grado
  • WGU C949 - Searching and Sorting Algorithms
  • Institución
  • WGU C949 - Searching And Sorting Algorithms

WGU C949 - Searching and Sorting Algorithms Questions and Answers 100% CorrectWGU C949 - Searching and Sorting Algorithms Questions and Answers 100% CorrectWGU C949 - Searching and Sorting Algorithms Questions and Answers 100% CorrectWGU C949 - Searching and Sorting Algorithms Questions and Answers...

[Mostrar más]

Vista previa 3 fuera de 17  páginas

  • 9 de octubre de 2024
  • 17
  • 2024/2025
  • Examen
  • Preguntas y respuestas
  • WGU C949 - Searching and Sorting Algorithms
  • WGU C949 - Searching and Sorting Algorithms
avatar-seller
WGU C949 - Searching and

Sorting Algorithms Questions and

Answers 100% Correct


Binary search - ANSWER-A faster algorithm for searching a list if the list's

elements are sorted and directly accessible (such as an array). Binary search

first checks the middle element of the list. If the search key is found, the

algorithm returns the matching location. If the search key is not found, the

algorithm repeats the search on the remaining left sublist (if the search key

was less than the middle element) or the remaining right sublist (if the

search key was greater than the middle element).




Binary search efficiency - ANSWER-For an N element list, the maximum

number of steps required to reduce the search space to an empty sublist is

[ log2 N ] + 1




Selection sort - ANSWER-Sorting algorithm that treats the input as two parts,

a sorted part and an unsorted part, and repeatedly selects the proper next

value to move from the unsorted part to the end of the sorted part.

,Selection sort efficiency - ANSWER-If a list has N elements, the outer loop

executes N times. For each of those N outer loop executions, the inner loop

executes an average of N/2 times. So the total number of comparisons is

proportional to N * (N/2), or O(N^2)




Selection sort (python) - ANSWER-# replace "^\.+" with space

def SelectionSort(numbers):

....for idx in range(len(numbers)):

........min_idx = idx

........for comp in range(idx+1, len(numbers)):

............if numbers[min_idx] > numbers[comp]:

................min_idx = comp

........temp = numbers[idx]

........numbers[idx] = numbers[min_idx]

........numbers[min_idx] = temp

if __name__ == "__main__":

....numlist = [ 99, 77, 33, 55, 11 ]

....print("Before: " + str(numlist))

....SelectionSort(numlist)

, ....print("After: " + str(numlist))




Binary search (python) - ANSWER-# replace "^\.+" with space

def BinarySearch(num, numbers):

....low = 0

....high = len(numbers) - 1

....mid = 0

....while low <= high:

........mid = (high + low) // 2

........if numbers[mid] < num:

............low = mid + 1

........elif numbers[mid] > num:

............high = mid - 1

........else:

............return mid

....return -1

if __name__ == "__main__":

....numlist = [ 11, 33, 55, 77, 99 ]

....for val in (11, 22, 55, 88, 99):

Los beneficios de comprar resúmenes en Stuvia estan en línea:

Garantiza la calidad de los comentarios

Garantiza la calidad de los comentarios

Compradores de Stuvia evaluaron más de 700.000 resúmenes. Así estas seguro que compras los mejores documentos!

Compra fácil y rápido

Compra fácil y rápido

Puedes pagar rápidamente y en una vez con iDeal, tarjeta de crédito o con tu crédito de Stuvia. Sin tener que hacerte miembro.

Enfócate en lo más importante

Enfócate en lo más importante

Tus compañeros escriben los resúmenes. Por eso tienes la seguridad que tienes un resumen actual y confiable. Así llegas a la conclusión rapidamente!

Preguntas frecuentes

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

100% de satisfacción garantizada: ¿Cómo funciona?

Nuestra garantía de satisfacción le asegura que siempre encontrará un documento de estudio a tu medida. Tu rellenas un formulario y nuestro equipo de atención al cliente se encarga del resto.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller NursingTutor1. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for 12,33 €. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

45,681 summaries were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Empieza a vender
12,33 €
  • (0)
  Añadir