DS 57 Exam Terminologies

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/49

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

50 Terms

1
New cards

What does Big O notation describe?

The upper bound of an algorithm's runtime.

2
New cards

What is the time complexity of binary search?

O(log n)

3
New cards

What is the time complexity of accessing an element in an array?

O(1)

4
New cards

What data structure uses contiguous memory for elements of the same type?

Array

5
New cards

What Python structure is mutable and ordered?

List

6
New cards

What Python structure is immutable and ordered?

Tuple

7
New cards

What is a dictionary in Python?

A key-value mapping with fast lookup.

8
New cards

What Python structure allows only unique values and is unordered?

Set

9
New cards

What is recursion?

A function that calls itself to solve smaller subproblems.

10
New cards

Why is a base case important in recursion?

To prevent infinite recursion.

11
New cards

What is the time complexity of linear search?

O(n)

12
New cards

Which algorithm divides the problem into smaller subproblems?

Divide and Conquer

13
New cards

Which algorithm stores results to avoid recalculating?

Dynamic Programming

14
New cards

Which algorithm makes the best decision at each step?

Greedy Algorithm

15
New cards

What is the main benefit of using a linked list?

Efficient insertion and deletion.

16
New cards

What is the drawback of using linked lists compared to arrays?

No direct access to elements.

17
New cards

What type of linked list allows backward and forward traversal?

Doubly linked list

18
New cards

What is a circular linked list?

A linked list where the last node points to the head.

19
New cards

What is the time complexity of inserting an element in a list?

O(n)

20
New cards

What is the space complexity of recursive factorial?

O(n)

21
New cards

What does O(n^2) time complexity usually result from?

Nested loops.

22
New cards

What is a brute-force algorithm?

An algorithm that tries all possible solutions.

23
New cards

What is the time complexity of merge sort?

O(n log n)

24
New cards

What does the in keyword check in Python?

Membership in a collection.

25
New cards

What is the use of len() in Python?

Returns the number of elements.

26
New cards

Which data structure is ideal for storing key-value pairs?

Dictionary

27
New cards

Which Python structure allows duplicates and is ordered?

List

28
New cards

What function returns both index and item during iteration?

enumerate()

29
New cards

Which data structure allows constant-time lookups by key?

Dictionary

30
New cards

Which Python structure cannot change once created?

Tuple

31
New cards

How do you access an element in a 2D array at row i, column j?

array[i][j]

32
New cards

Which type of loop leads to logarithmic time complexity?

Loop that halves the data each iteration.

33
New cards

What type of list is best for constant-time appends?

List

34
New cards

What is the complexity of a loop within a loop over the same data?

O(n^2)

35
New cards

What function removes the last item in a list?

pop()

36
New cards

How is a tuple different from a list?

Tuples are immutable.

37
New cards

Which method adds an item to the end of a list?

append()

38
New cards

How do sets handle duplicate values?

They automatically remove them.

39
New cards

What is the purpose of the hash function in dictionaries?

To map keys to indexes.

40
New cards

What is a randomized algorithm?

An algorithm that uses randomness to decide steps.

41
New cards

What is a singly linked list?

A list where each node points only to the next.

42
New cards

What does max() do in Python?

Returns the largest element.

43
New cards

What is the time complexity of accessing a dictionary value?

O(1)

44
New cards

What structure is preferred for fast membership testing?

Set

45
New cards

What is the overall complexity of merge sort?

O(n log n)

46
New cards

What is the space complexity of a list with n elements?

O(n)

47
New cards

Which operation is faster in a tuple compared to a list?

Iteration.

48
New cards

What is the default time complexity of deleting an item from a list?

O(n)

49
New cards

What type of algorithm guarantees an optimal result in all cases?

None - greedy and others don't guarantee optimality.

50
New cards

Which Python type can be used as dictionary keys?

Tuple