DSA prefi

0.0(0)
Studied by 2 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/39

encourage image

There's no tags or description

Looks like no tags are added yet.

40 Terms

1
New cards

Heap

A complete binary tree where each parent node's value is either higher or lower than the value of its child nodes.

2
New cards

Min Heap

A heap where the value of each parent node is less than or equal to the values of its child nodes.

3
New cards

Max Heap

A heap where the value of each parent node is greater than or equal to the values of its child nodes.

4
New cards

ArrayList

A resizable array implementation in Java from the java.util package used to create heaps.

5
New cards

addAll() method

A method to create a heap with initial values of the Collections class in Java.

6
New cards

Priority Queue

A special type of queue where elements are processed based on their natural or custom order.

7
New cards

PriorityQueue class

A Java class used to implement priority queues from the java.util package.

8
New cards

Enqueue

To add an element to a priority queue using add() or offer().

9
New cards

Dequeue

To remove an element from a priority queue using poll() or remove().

10
New cards

Comparator

An interface in Java used to create a specific ordering for a collection of objects.

11
New cards

comparing() method

A method in the Comparator interface used to define a custom comparison.

12
New cards

Set

A collection of unique elements in Java.

13
New cards

Union of sets

A set that contains all elements in either of two sets (A ∪ B).

14
New cards

Intersection of sets

A set containing only the elements common to both sets (A ∩ B).

15
New cards

Difference of sets

The set that contains elements in A but not in B (A – B).

16
New cards

Subset

Set A is a subset of set B (A ⊂ B) if every element of set A is in set B.

17
New cards

HashSet

A set implementation in Java that stores elements in a hash table without guaranteed order.

18
New cards

TreeSet

A set implementation in Java that stores elements in a sorted order (natural or custom).

19
New cards

LinkedHashSet

A set implementation in Java that maintains insertion order using a hash table and linked list.

20
New cards

containsAll() method

A method used to determine if one set contains all elements of another set.

21
New cards

retainAll() method

A method used to find the intersection of two sets.

22
New cards

removeAll() method

A method used to determine the difference between two sets.

23
New cards

Curly braces in Python

Used to implement sets in Python.

24
New cards

Dictionaries in Python

Maps in Python that use key-value pairs defined with a colon (:) within curly braces.

25
New cards

Map

A set of ordered pairs where elements are known as keys and values.

26
New cards

HashMap

A general-purpose map implementation in Java that does not guarantee order.

27
New cards

TreeMap

A general-purpose map implementation in Java that keeps its keys sorted.

28
New cards

LinkedHashMap

A general-purpose map implementation in Java that maintains insertion order.

29
New cards

put() method

A method used to insert a mapping in a map in Java.

30
New cards

remove() method

A method used to delete the mapping for a key in a map in Java.

31
New cards

replace() method

A method used to replace a key's value in a map in Java.

32
New cards

get() method

A method used to retrieve the value based on the key in a map.

33
New cards

containsKey() method

A method used to check if a map contains a mapping for a specified key.

34
New cards

keySet() method

A method that retrieves all keys of a map.

35
New cards

values() method

A method that retrieves all values of a map.

36
New cards

items() method

A method in Python used to display entries in a dictionary.

37
New cards

issubset() method

A method in Python to determine whether a set is a subset of another set.

38
New cards

Example of creating an empty set in Java

Set a = new HashSet();

39
New cards

Example of initializing a set in Python

a = set(['Mark', 'Nika', 'Mairo', 'Kae'])

40
New cards

Example of checking membership in a dictionary

print('M2' in name_map)