Data Structure Flashcards

1
Q

to what DB the questions of Strings is similar to?

A

Arrays

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

How does hash map works?

A

check

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

what is the problem in hash map?

A

number of collision is very high

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

worst case runtime of hash map?

A

O(N) n is the number of keys, but good implementation keeps collision to minimum the run time is O(1)

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

how to implement hash table with balanced binary search tree?

A

IDK

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

what is an array list? and what is it’s access run time?

A

it’s an array that resize itself as needed while providing O(1) access

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

what is the run time of resizing the array list?

A

O(N) n is the number of items in the array list, but it happens so rarely, we can say that the insertion time is O(1)

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

why the run time of insertion in array list is O(1)

A

IDK

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

what is a linked list?

A

it’s a data structure that represent a sequence of nodes.

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

linked list vs array?

A

IDK

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

How to implement a linked list?

A

IDK

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

what is the difference between looping while(n.next != null), while(n!= null), or while(n.next.next != null).
where n is the current node.

A

IDK

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

what is the difference between singly and doubly linked list?

A

IDK

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

what is the runner technique in Linked lists?

A

it’s a second pointer technique.
means iterate through the linked list with two pointers simultaneously.

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

linked list and recursion.

A

IDK

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

what operations does stack uses?

A

pop() remove the top item from the stack
push(item) add an item to the top of the stack
peek(): return the top of the stack
isEmpty() return true if and only if the stack is empty

17
Q

sum all the cons and pros of all data structures in table.

A

++++++++++++++++++++++++++_+

18
Q

what operations does a queue uses?

A

add(item): add an item to the end of the list
remove(): remove the first item in the list
peek() return the top of the queue
isEmpty() return true if and only if the queue is empty

19
Q

where do we often use queues?

A

in BFS or implementing a cache.

20
Q

what the heap is used for? and what it’s operation and complexity time?

A

Heaps are commonly used to implement priority queues
insertion: O(log N) where ‘N’ is the number of elements. insert it at the end then rearrange the heap
deletion O(log N) delete then rearrange the heap.
peek: O(1) peek the root