Sets and Maps

16 flashcardspar Maria
Réviser ces flashcardsGratuit · répétition espacée · iPhone, Android, Mac et web

Toutes les cartes

1
What is the advantage of storing data in binary format?
Records are the all the same size so they are easy to access randomly, and update.
2
What are the two basic ways to represent a set?
explicitly - uses a bit vector
implicitly - uses List, usually sorted List to improve Big O notation
3
What does it mean to "serialize" an object.
Professor answer: Copy an object to an output stream in a way that when deserialized it maintains its structure, i.e. a binary tree.
Better answer lol To serialize an object means to convert it into a flat, transferable format that captures its data and structure, allowing it to be saved or sent elsewhere and then reconstructed back into an object. This is essential for persistence, data sharing, and communication between systems.
4
The mathematical definition of a set is that is has no particular order. However when we use HashSet or TreeSet there is certain ordering given to the elements of the set because of the basic data structure that they are stored in. What is the difference between the "order" for a HashSet and a TreeSet.
A HashSet is ordered by the hashcode. A TreeSet is ordered by the natural ordering of the objects being placed in to the Set.
5
What is a map?
A mapping from the key set to the value set. It associates a key to a value.
6
What are the two ways data can be stored?
1) Key
2) Binary
7
Every [A] in a map has a unique value.
Key
8
Random access files use a [A] to determine the location in the file to read from or write to.
File pointer
9
A [A] in a map can be associated with several keys.
Value
10
ObjectInputStream and ObjectOutputStream can only read/write objects that support the [A] interface.
Serializable
11
What is the difference between a set and a map?
A set stores unique elements. A map stores associations between keys and values.
12
What are the basic operations that are unique to a Set?
[A] union
[B] intersection
[C] difference
13
How would 12,345 be represented in:
text format [A]
binary format[B]
Text Format: stored as characters
'1' '2' '3' '4' '5'
Binary Format: stored as 4 bytes
0 0 48 57
14
Classes that implement Serializable but require special handling during the serialization and deserialization process must give definitions for which methods:
[A] readObject
[B] writeObject
15
What are the two most common Java library classes that implement the Set interface?
[A] HashSet
[B] TreeSet
16
What does it mean to "serialize" an object?
Copy an object to an output stream in a way that when deserialized it maintains its structure, i.e. a binary tree.
Réviser les 16 cartes gratuitement

Plus de flashcards : Histoire et lettres

Shakespearean idioms13 cartesHistoire et lettres · Anglaisanya€Egypt Tiimeline10 cartesHistoire et lettres · Anglaismrwright07KP ILR 1+ Refined Words List188 cartesHistoire et lettres · CoréenHwanThe Tempest Adaptations and Critics102 cartesHistoire et lettres · AnglaisemiLinguistics and Representation Terms70 cartesHistoire et lettres · AnglaisAnaïsUSD Rock MUS 100: Elements I & II55 cartesHistoire et lettres · AnglaisAlaynascholars ++43 cartesHistoire et lettres · Anglaisanya€Mapeh 4qr35 cartesHistoire et lettres · AnglaisHernandezArt29 cartesHistoire et lettres · Anglaisemma.beelFab Vocab 26-5025 cartesHistoire et lettres · AnglaisWinnARTH 120 cartesHistoire et lettres · AnglaisMikeyMidterm - Art Shows16 cartesHistoire et lettres · AnglaisMorgs

Tous les decks : Histoire et lettres

Révise ces decks dans l’app

Gratuit sur iPhone, Android, Mac et le web. Ajoute n’importe quel deck à ton compte en un tap.

Télécharger dans l’App StoreDisponible sur Google Play
Réviser les 16 cartes gratuitement