Paper 2 Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Describe the differences between queues and stacks

A

Stacks use LIFO whereas Queues use FIFO

Stacks have one top pointer, queues have one front and one back pointer

Stacks have push, pop and peek built in functions

Queues have functions to rearrange pointers when an item is removed or added

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

Describe the differences between functions and procedures

A

Functions have to return a value whereas procedures are unlikely to return any value,

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

Describe how bubble sort works

A
  • go through array, comparing each item with the one next to it, If it is greater, swap them
  • Repeat n-2 times
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe how insertion sort works

A

The algorithm takes one data item from the list and places it in the correct location in the list and this process is repeated until there are no more unsorted data items in the list

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

Describe how merge sort works

A
  • Divide the unsorted list into n sublists, each containing one element
  • Repeatedly merge sublists in order to produce new sorted sublists until there is only one sublist remaining
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the time complexity of bubble sort?

A

O(n^2)

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

What is the time complexity of insertion sort?

A

O(n^2)

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

What is the time complexity of merge sort?

A

O(nlog n)

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

Describe the orders of traversal for trees

A

Draw an outline around the tree structure from left to root and follow the path

Pre-order traversal - as you pass to the left of the node

In-order traversal - as you pass underneath a node

Post-order traversal - as you pass to the right of a node

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

What are the three essential characteristics of recursion?

A
  • Stopping condition
  • Routine must call itself
  • Stopping conditions must be reached after a finite number of calls
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Describe the steps in Dijkstra’s algorithm

A
  1. Set all distances to ifinity apart from starting node
  2. Pick first node and calculate distances to adjacent nodes
  3. Pick next node with minimal distance; repeat adjacent node distance calculations and overwrite if value is smaller than original
  4. Final result can be found from following the parent table
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is abstraction?

A

The separation of the physical and logical aspects of a problem where all details that doesn’t directly contribute to the problem at hand are ommited

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

Describe cashing

A

The temporary storage of data and instructions

  • Faster access to cached resources
  • Saves on costly use of bandwidth
  • Reduces load on web services in a client-server environment
  • Slower performance if the resource isn’t found
  • Could be given an outdated resourse
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Describe data mining

A

Data mining is the process of digging through big data sets to discover hidden connections and predict future trends, typically involving the use of different kinds of software packages

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

Describe the advantages of data mining

A

Helps marketing companies build models based on historical data to predict who will respond to the new marketing campaigns leading to an increase in profits

Helps government agencys by digging and analyzing records of financial transactions to build patterns that can detect money laundering or criminal activites

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

Describe the disadvantages of data mining

A

Leads to privacy issues, businesses collect lots of information about customers in many ways however businesses can get hacked and that can lead to your sensitive information being leaked

Data mining is not perfectly accurate and can be incorrect which will lead to businesses that trusted blindly to lose profit

17
Q

Explain why you would use a text editor over an IDE

A

IDE
-Auto-completion can act as an obstacle when learning

-Distracted easily by the cumbersome menu options an IDE provides

Text Editor
-No distractions, a single toolbar with some options

-No error highlighting so manually analyse and fix bugs will improve your debugging skills

18
Q

Explain why you would use an IDE over a text editor

A
  • IDE’s come with preinstalled libraries
  • Supports external plugins
  • Syntax highlighting features
  • Error checking is easy with the console
  • Auto completion of commands