GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Given an ordered list with 15 elements, how many elements mu…

Given an ordered list with 15 elements, how many elements must be visited in the worst case of binary search?

Read Details

Consider the following recursive function: def r(xs: list[in…

Consider the following recursive function: def r(xs: list[int]) -> list[int]:    match xs:        case []:            return []        case [x]:            return [x]        case [first, second, *rest]:            return [first] + r(rest) + [second] What list will r([1, 2, 3, 4]) return?

Read Details

The function at_least returns True if at least two values in…

The function at_least returns True if at least two values in a list of booleans are True. Provide the Big‑O running time for the following function. def at_least( arr: list[bool] ) -> None:    count = 0    for i in range(0, len(arr)):        if arr[i] == True:            count += 1    return count >= 2

Read Details

Consider the following recursive function: def p(xs: list[in…

Consider the following recursive function: def p(xs: list[int]) -> list[int]:    match xs:        case []:            return []        case [x]:            return [x]        case [first, second, *rest]:            return p(rest) + [first, second] What list will p([1, 2, 3, 4, 5]) return?

Read Details

Suppose you want a recursive function, product(xs: list[int]…

Suppose you want a recursive function, product(xs: list[int]) -> int, that multiplies all the numbers it’s passed. Imagine the implementation — what do you suppose the base case for the product(..) function should return if [] is matched?

Read Details

What is the worst case runtime for removing the smallest fro…

What is the worst case runtime for removing the smallest from a min heap?

Read Details

Consider the selection sort function and function call shown…

Consider the selection sort function and function call shown below: note: minimumPosition(values, i) returns the index of the smallest value in the values list starting from i (inclusive) def selectionSort(values: list[int]) -> None :   for i in range(len(values)) :      print(values)      minPos = minimumPosition(values, i)      swap(values, minPos, i) data = [1, 2, 3]selectionSort(data)print(data) What is displayed when this code segment executes?

Read Details

An algorithm that tests whether the first list element is eq…

An algorithm that tests whether the first list element is equal to any of the other list elements would be an ____ algorithm.

Read Details

Which of the following occupancy factors would accurately de…

Which of the following occupancy factors would accurately describe total occupancy (administrative or clerical offices, adjacent x-ray rooms, nurses stations, etc)?

Read Details

During routine radiographic procedures, when a protective ap…

During routine radiographic procedures, when a protective apron is not being used, occupational personnel should place the primary dosimeter at the front of the body at the collar level to approximate the location of maximal radiation dose to which of the following body parts?

Read Details

Posts pagination

Newer posts 1 … 1,279 1,280 1,281 1,282 1,283 … 85,662 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top