Embercode
✕
Time and Space ComplexityQuick quiz

Library and hash costs

8 questions. Covers Hash table costs.

Questions 1 to 5 of 8

  1. 1. What does this code print? ``python items = [] shifts = 0 for i in range(4): shifts += len(items) items.insert(0, i) print(shifts, items) ``
  2. 2. What does this code print? ``python from collections import deque dq = deque([1, 2, 3]) dq.appendleft(0) dq.popleft() print(list(dq)) ``
  3. 3. A loop builds a string of 1000 pieces, one character each. Each step with s = s + "x" copies the whole string, as in the copied_characters run in the lesson. How many characters are written in total?

    Type a number.

  4. 4. Which statements about checking membership with in are true?

    Pick every answer that is true.

  5. 5. A loop adds to a string with +=, and another variable still holds the old string, so the whole string is copied on each step. When n doubles, how does the total time change?

5 question(s) left on this page.

Typed answers ignore extra spaces and, for most questions, capital letters.