misc Flashcards

1
Q

time complexity of merge sort

A

nlog(n)

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

time complexity of bubble sort and why

A

O(n2), n items will be examined, n number of times

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

base case def

A

problem that can be solved without any more recursive calls, stops infinite recursion

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

heuristic solution

A

discounting consideration of options which may not be the best

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

static vs dynamic data structures

A

dynamic can shrink/grow during run time
static size must be declared at compile

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

protected vs private

A

protected can only be accessed in class and derived subclasses

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

why would an adjacency matrix be used

A

many edges between vertices
edges rarely change

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

what is the halting problem

A

non computable problem that determines if the program will stop without running. the program

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

4 components of a Turing machine

A

read/write head
transition rules
halting states
state register

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

what is a universal Turing machine

A

a Turing machine that can simulate any other Turing machine
and compute any computable sequence

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

why is a UTM more powerful than any other device

A

infinite amount of memory/tape

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

representational abstraction def

A

removing extraneous details

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

abstraction by generalisation

A

grouping by similar traits

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

pros and cons of dynamic data structure

A

No excess memory used
no limit to number of items that can be added
BUT additional memory used for pointers
BUT memory leak possible

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

how does a queue work

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

how does a priority queue work

A

move each item back one place, starting at the rear, until you find an item with same or higher priority to add
Add the item behind that

17
Q

explain how a value is stored in a hash table

A

hashing algo is applied to key
result is the index to store at
collision when same key generated
collision handling method is used

18
Q

steps involved in rehashing

A

larger hash table created
values from old table transferred over
to a position determined by new hashing algo

19
Q

procedural decomposiiton

A

breaking it down to smaller problems
to give identifiable tasks and smaller sub problems

20
Q

benefits of RPN

A

easier for computer to understand
simpler to code
no brackets needed