Sets and Maps

16 flashcardsby Maria
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

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.
Study all 16 cards for free

More History & humanities flashcards

english class 3 ch 1 bright morning 17 cardsHistory & humanities · EnglishIsmatEnglish lesson five 14 cardsHistory & humanities · EnglishMinniepaíses y capitales (america)10 cardsHistory & humanities · SpanishValentinoRenaissance155 cardsHistory & humanities · EnglishzaniVocabulary: smart120 cardsHistory & humanities · EnglishNaiwwwFive Year Plans, Collectivisation74 cardsHistory & humanities · EnglishAmélieAP world history dates 1-457 cardsHistory & humanities · EnglishdaitanfutekinaNietzsche: Eternal Recurrence and Life Affirmation46 cardsHistory & humanities · EnglishDarcyStone Ages Study Guide37 cardsHistory & humanities · Englishmrwright07Analyse du poème : Le Dormeur du val (Rimbaud)31 cardsHistory & humanities · Frenchan OutLearn studentOutlines Islands & Cities25 cardsHistory & humanities · Englishbtoff49Pippin Lines (Lewis)21 cardsHistory & humanities · EnglishKenneth

All History & humanities decks

Study these decks in the app

Free on iPhone, Android, Mac and the web. Add any deck to your account in one tap.

Download on the App StoreGet it on Google Play
Study all 16 cards for free