CS basics, Algorithms & Data structures Flashcards

1
Q

Data structures e.g. Stack vs queue

A

Stack vs queue
The primary difference between Stack and Queue Data Structures is that Stack follows LIFO while Queue follows FIFO data structure type. LIFO refers to Last In First Out. It means that when we put data in a Stack, it processes the last entry first. Conversely, FIFO refers to First In First Out.

The stack can be used to solve problems like pre-order, post-order and in-order traversal of the binary tree, which are based on recursion, whereas queue can be used to solve problems like producer-consumer problem involving sequential processing of underlying data.

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

Boolean operations, short circuits in Boolean operations

A

t

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

Complexity of algorithms, big O notation

A

Big O notation is used to show the performance optimization of the solution. On the other hand, it’s used to demonstrate how fast or resource consumption is the solution.
the common big O notations are as follows:

O(1): this is the best performance. which means the constant time, no matter how big the input is. for instance: a condition or assigning a variable.

O(log n): log n is almost like O(1), it’s a little bit more than that, but in the end, it’s one of the best. for instance: a search algorithm.

O(n): The is a linear time complexity, which means it takes only as long as the input is. for instance: a sorting algorithm.

O(n^2): it is called quadratic which is a high-performance solution, for instance, nested for loop.

O(2^n): it’s a very high-performance solution, for instance, Fibonacci or recursion.

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

Trees, graphs and ways to traverse graph

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

Sorting algorithms

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

Recursion, tail recursion, mutual recursion

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

Search in binary tree

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

Linear-time sorting. (count sort)

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

Sorting of linked list

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

Prefix and suffix trees

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

Describe heap

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

Greedy Algorithm

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

NP-complete algorithms

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

Map/reduce and divide and conquer approach in solving tasks

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

Dynamic programming

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

How would you fix a cyclic dependency

A
17
Q

What is the difference between static and dynamic typing? Duck typing?

A
18
Q

Binary tree

A
19
Q

Self balanced trees (Red-black tree, AVL, Splay)

A
20
Q

HashTable

A

This is my favorite data structure, it’s clever we have key-value pair with instant access.

how it’s work?
we convert the key to an integer key through a hash function. and using the same hash function to get the key in order to access the value. Sometimes we may get into a collision. which we solve by using LinkedList.