3. Fundamentals of Algorithms Flashcards
What is the order of values for each iteration of a Bubble Sort Algorithm applied to [7, 3, 9, 5, 4, 2]?
[7, 3, 9, 5, 4, 2]
[3, 7, 5, 4, 2, 9]
[3, 5, 4, 2, 7, 9]
[3, 4, 2, 5, 7, 9]
[3, 2, 4, 5, 7, 9]
[2, 3, 4, 5, 7, 9]
What is the order of values which are visited when searching for the target value 5 in the Array [1, 2, 5, 7, 11, 15, 18] using the Binary Search Algorithm?
7, 2, 5
How is Depth First Search implemented differently from Breadth First Search?
Depth First Search uses a Stack
Breadth First Search uses a Queue
What is the purpose of Dijkstra’s Algorithm?
Dijkstra’s Algorithm calculates the shortest path and the distance between two nodes in a Graph.
Describe an Exhaustive Search approach to Problem Solving.
Exhaustive Search is when every possibility is checked only finishing when the correct answer is found or it is determined that no answer exists. An example of Exhaustive Search is a Linear Search applied to an Array.
Describe a Divide and Conquer approach to Problem Solving.
Divide and Conquer breaks a problem into smaller sub-problems which may be simpler to solve individually. An example of Divide and Conquer would be the Binary Search or Merge Sort Algorithms.
What does a Regular Expression allow you to do?
A Regular Expression is a string pattern which can be used to match other strings. For example we could create a Regular Expression to tell us whether a string contained an email address or a numberplate.