Arrays and Hashing

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

1/10

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.

11 Terms

1
New cards

What is an array?

A data structure that is a collection of items of the same variable type that are stored at contiguous memory locations.

2
New cards

What is hashing?

A technique where data is mapped to a specific hash table index using a hash function for ease of access. Inserting, deleting and searching all have a time complexity of O(1).

3
New cards

What data structure is contains duplicate associated

to?

Arrays and Hashing

4
New cards

How should you answer contains duplicate?

class Solution:

def containsDuplicate(self, nums) -> bool:

seen = set()

for num in nums:

if num in seen:

return True

seen.add(num)

return False

5
New cards

Why are sets beneficial?

Checking a set has O(1) time complexity

6
New cards

What are the 2 main data structures in python context?

Linear and hash-based structures

7
New cards

What is the linear data structure?

Arrays

8
New cards

What are some features of an array?

Searching is O(n) we have to go one by one, but accessing by an index is O(1)

9
New cards

What are some hash-based structures?

Hash tables which use arrays + hash functions

10
New cards

What are sets?

Store unique values, with no order O(1) complexity

11
New cards

What are dictionary features?

Has a O(1) time complexity and based on key value pairs