CS basics Flashcards

1
Q

Data structures e.g. Stack vs queue

A

stack uses LIFO
queue uses FIFO

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

Describe heap

A

heap is a data structure made up of “nodes” that contain values.
tree

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

Boolean operations, short circuits in Boolean operations

A

, & , ^ , ! , || , && , == , !=
circuit - when all conditions are not checked if not needed: && and ||

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

Recursion, tail recursion, mutual recursion

A

head - recursive call before other processing in the function
tail - the processing occurs before the recursive call.
Mutual recusion - two objects are defined in terms of each other

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

Sorting algorithms

A

Bubble sort - compare each pair
Insertion Sort - compare each with previous
Selection Sort - fin mininum. put in start
Merge Sort - divide into sublists and sort
Quick Sort - take element. move less to the left, move more to the right. repeat

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

Complexity of algorithms, big O notation

A

big-O notation is an asymptotic upper bound

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

Trees, graphs and ways to traverse graph

A

tree is an undirected graph in which any two vertices are connected by exactly one path

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

Binary tree

A

each node has up to two child nodes

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

Search in binary tree

A
  1. Start from root.
  2. Compare the inserting element with root, if less than root, then recurse for left, else recurse for right.
  3. If element to search is found anywhere, return true, else return false.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Dynamic programming

A

is a method for solving a complex problem by breaking it down into a collection of simpler subproblems

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

How would you fix a cyclic dependency

A

Use interfaces

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

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

A

Static typing means that type errors are reported at compile time
dynamic typing means that type errors are reported at runtime
duck typeing - object supports operation. no matter what type

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