Data Structures Flashcards

1
Q

What is UTF-8

A

Encoding standard, same as ASCII for Latin letters. Every code point from 0-127 is stored in a single byte (8 bits). Code points > 128 is stored in 2 - 6 bytes.

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

Character encoding. What happens when you type keys on a keyboard?

A

Provides a key to unlock code. It is a set of mappings between the bytes in the computer and the characters in a character set.

When you enter keys on a keyboard, the character encoding maps characters you choose to specific bytes in computer memory.

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

What are ASCII characters?

A

255 characters to be used that map back to 8 bit bytes.

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

Unicode

A

Comprehensive encoding that represents all possible characters

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

What is an array

A

A contiguous area of memory consisting of equal sized elements. You can store primitive types, objects, or references to other arrays.

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

What is the performance of adding and removing an element from the beginning, end, and middle of an array

A

Beginning: Add – O(n) / Delete O(n)
Middle: Add – O(n) / Delete O(n)
End: Add - O(1) / Delete O(1)

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

When should you use a linked list over an array

A
  • You need insertions/deletions to be fast

* You insert or delete items in the middle of a list

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

When should you use arrays over linked lists

A
  • You frequently need random, unordered access to the data
  • You need fast performance to perform reads
  • The number of items doesn’t change during execution so you can easily allocate contiguous memory.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the complexity of adding, deleting and searching for nodes in a Linked List

A

Add and Delete: 0(1)

Search: O(n)

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

How do you traverse a linked list

A

When starting at the head, you should make note of the current node and continue to loop through until reaching the tail. Progressing through the list involves setting the currentNode = nextNode

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

How would you reverse a singly Linked List

A

Starting at the head, I would keep track of the current, previous, and next nodes, resetting the current node’s next node = previous node, then continue to progress through the list by setting the current node to the next node.

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