Computer science in plain English Flashcards

1
Q

What is Random Access Memory (RAM)?

A

When a computer is running code, it needs to keep track of variables (numbers, strings, arrays, etc.).

Variables are stored in random access memory (RAM). We sometimes call RAM “working memory” or just “memory.”

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

How does RAM store variables?

A

RAM is like a big bookshelf and it is numbered and the numbers are called addresses.
Each Shelfs holds 8 bits.

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

RAM have memory slots that are 8 bits.
What is bit?

A

A bit is a tiny electrical switch that can be turned “on” or “off.” But instead of calling it “on” or “off” we call it 1 or 0.

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

What is byte?

A

Each slots in RAM is 8 bits storage. And 8 bits is called one Byte.

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

What is Binary Number?

A

Binary number is a base 2 number expressed in 0s and 1s.

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

What is Fixed-width integers?

A

Fixed-width integers are numbers that will occupy space in RAM and for every fixed-width integer our ram assigns fixed width space.
Eg:- if our program stores integer in fixed width 64bit then
number 1 and number 10000000 will be stored in 64bit no matter how much space they require.

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

How does we store array in RAM?

A

stores them in contiguous and adjacent memory locations.

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

The time complexity of append and prepend for LinkedList and Dynamic Array?

A

The average case for both is O(1).
But the average case for Dynamic Array in append is Amortized O(1) and O(n) in prepend.
And the worst case for Dynamic Array in append and prepend is O(n).
and the worst case for LinkedList is O(1).

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

What is better in lookup time between Dynamic Array and LinkedList?

A

Dynamic Array has lookup time of O(1) b/c they are lined up consecutively. But LinkedList Lookup time is O(ith) time.

So the tradeoff with linked lists is they have faster prepends and faster appends than dynamic arrays, but they have slower lookups.

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

What is Logarithm?

A

“What power must we raise this base to, in order to get this answer?”
log base 10 (100) = 2
The 10 is called the base (makes sense—it’s on the bottom). Think of the 100 as the “answer.” It’s what we’re taking the log of. So this expression would be pronounced “log base 10 of 100.”

And all it means is, “What power do we need to raise this base (10) to get this answer (100)?”

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

What are logarithm rules?

A

Check Logarithm rules in website.
https://www.interviewcake.com/article/python3/logarithms?course=fc1&section=algorithmic-thinking

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

What are common log types used in computer science?

A
  1. Log base 2 (n) = lg n
  2. log base 10 (n) = log n
  3. log base e (n) = ln n
  4. in computer science log n means log base 2 (n) its not sometimes same with maths log n which means log base 10 (n).
How well did you know this?
1
Not at all
2
3
4
5
Perfectly