Week 5 Test Flashcards

1
Q

what is complexity analysis?

A

reading code and determining the rate of growth through analysis instead of manually testing the code

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

what is big o notation used for

A

to express complexity analysis

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

what is Big o’s main concern

A

the general shape of the growth curve when a function is passed in a large value

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

why is big O not concerned with small values?

A

computers are so fast that even inefficient code returns almost immediately for a small number

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

what is the correlation between code beginning to behaving slowly and the steep of efficiency curve

A

the steeper the code, the faster the performance will degrade

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

what does it mean for a function to have constant growth

A

the runtime remains constant whether the input os large or small

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

what does space complexity describe?

A

how much memory the function requires

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

what are the space and time complexities of arr.push

A

time: 1*
space: 1*
requires no shifting and happens in place

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

what are the space and time complexities of arr.pop

A

Time: 1
space: 1
requires no shifting and happens in place

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

what are the space and time complexities of arr.shift

A

time: n
space: 1
requires all elements shift to the left by one, but happens in place

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

what are the space and time complexities of arr.unshift

A

time: n
space: 1
requires all elements shift to the right by one, but happens in place

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

what are the space and time complexities of arr.splice

A

time: n
space: n*
requires shifting to fill empty spaces and returns an array possibly of unknown length

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

what are the space and time complexities of slice

A

time: n
space: n
ceates a copy of the old array with some of all elements slice out; the values sliced have to be copied individually

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

what are the space and time complexities of arr.indexOf

A

time: n
space: 1
this will search and visit each node and the worst case is that the elemt is at the end of the array or not present at all, no space required

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

what are the space and time complexities of arr.map

A

time: n
space: n
creates a new array with some function applied to each element this is with the assumption that the cb is O(1)

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

what are the space and time complexities of arr.filter

A

time: n
space: n
iterates over each element and adds values to a new array based on booleans

17
Q

what are the space and time complexities of arr.reduce

A

time: n
space: 1
iterates over each element and applies a reducer function. assumes reducer is O(1); no additional space required

18
Q

what are the space and time complexities of arr.reverse

A

time: n
space: 1
moves all n elements in place

19
Q

what are the space and time complexities of spread

A

time: n
space: n
copy each element into a new array without altering the original

20
Q

what is XOR and what is its symbol

A

the symbol is ^; XOR means the exclusive or, so one or the other, but not both

21
Q

what does the base refer to in a counting system?

A

how many digits there are in the system

22
Q

what is the relationship between bits and bytes

A

bits is short for binary digits which refers to each individual digit in a binary code
a group of 8 bits is a byte

23
Q

what is ASCII

A

the american standatrd code or information interchange
a standard for changing bits into characters

24
Q

how to go from base 10 to base 2 or base 16

A

variableHoldingNumber.toString(baseNumberOfTypeGoingTo)

25
Q

how to go from base 16 or base 2 to base 10

A

parseInt(stringOfOtherNumberType, baseNumberOfTypeComingFrom)

26
Q

how to go from decimal to ASCII

A

String.fromCharCode(number)
this will accept any tyoe of number not even just decimal

27
Q

how to go from ASCII to decimal

A

String.protoype.charCodeAt(index)

28
Q

what is memory

A

refers to random access memory aka RAM which dtores data for programs currently in use including the operating system and background processes

29
Q

what is the difference between RAM and drive storage

A

drive storage is for long term data storage
RAM is much faster but also more expensive per bit
RAM requires active power source, but drive storage can persit data without power

30
Q

what is a computer science array

A

a sequence of elements of the same type stored in a contiguous block of memory

31
Q

what is a hash function

A

a function that takes in an input, runs it through a set of deterministic steps and returns a scrambled output. given the same input, it will always return the same output

32
Q

what is SHA256

A

a secure hashing algorythm that given any number of bits, will return an output of 256 bits
this will retirn a completely different output for similar inputs