Data structures Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

What is an array?

A

An array is a collection of items of same data type stored at contiguous memory locations

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a Linked List?

A

a linked list consists of nodes where each node contains a data field and a reference(link) to the next node in the list. (look a like an array but on different memory locations)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Downsides of a Linked List?

A
  1. Searching is slow (linear search)
  2. Takes more memory (because it also stores the memory location and value.
  3. relative difficult to sort
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Upside of Linked List?

A

Faster to add or remove items

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a hashtable (hashmap)

A

Hash Table is a data structure which stores data in an associative manner. In a hash table, data is stored in an array format, where each data value has its own unique index value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Upside of a hashtable?

A

Fast searching, fast inserting

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Downside of a hashtable

A

Takes more memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is a trie?

A

A trie (derived from retrieval) is a multiway tree data structure used for storing strings over an alphabet. It is used to store a large amount of strings. The pattern matching can be done efficiently using tries.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Upside of using a Trie

A
  1. In tries the keys are searched using common prefixes. Hence it is faster. The lookup of keys depends upon the height in case of binary search tree.
  2. Tries take less space when they contain a large number of short strings. As nodes are shared between the keys.
  3. Tries help with longest prefix matching, when we want to find the key.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What a 3 downsides of using an Array?

A
  1. insertion is bad
  2. deleting items is bad
  3. stuck with a fixxed size
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are 3 upsides of using an array?

A
  1. Looking up items is good
  2. relative easy to sort an array
  3. Relative small in memory-size
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly