Computational Thinking topic 4

¡Supera tus tareas y exámenes ahora con Quizwiz!

What is the famous Four Colour Theorem in graph theory? [2]

'every planar graph can be properly coloured using just 4 colours

Give two illustrations of principles of Computational Thinking in the context of problem solving. [2]

'using abstraction in tackling a large complex task so as to separate concerns' 'reformulating a difficult problem into one which we know how to solve using reduction, embedding, transformation, and simulation'

Sometimes we can decide whether a graph can be coloured with a certain number of colours, k say, by transforming the graph into a smaller graph so that the original graph can be k-coloured if, and only if, the transformed graph can. On occasion, we can iteratively do this so that we get a graph so small that we can trivially see whether or not it can be k-coloured. Give an example of such a transformation that we might use in this way. Apply your transformation to decide whether the graph in Fig. 1 can be coloured using 4 colours. [8]

4.20 Making finding colourings easier

What is a graph? What is a proper colouring of a graph and an optimal colouring of a graph? Describe two different algorithms (in English) that enable you to colour graphs. Explain whether or not your algorithms yield an optimal colouring (you may use graphs to illustrate your answer if you wish). Show how your algorithms proceed when you wish to decide whether the graph in Fig. 1 can be coloured using 4 colours. [20]

A graph is a collection of nodes and edges. These nodes can be connected via edges to show relationships. optimal if it is proper and uses as few colours as possible. A greedy algorithm, still need 1 more

Give a precise definition of a search problem and of a solution of a search problem. [5]

A search problem S consists of: • a set of instances I; • a set of solutions J; and • a binary search relation R ⊆ I × J. In order to solve a search problem, for any instance x ∈ I, we need to: • findasolutiony∈J suchthat(x,y)∈R,ifthereisone;or • answer 'no' if there is no solution y for which (x, y) ∈ R.

What is abstraction in relation to real-world problem solving? How does abstraction in Computer Science differ from abstraction in other subjects? [4]

Abstraction is the process of eliminating specificity by ignoring certain features. In computer science, abstraction is multilayered and is more concerned with information hiding than information neglect

Give a (not necessarily precise) definition of what it means for an algorithm to be greedy. [2]

An algorithm that always takes the best immediate, or local, solution while finding an answer. Greedy algorithms find the overall, or globally, optimal solution for some optimization problems, but may find less-than-optimal solutions for some instances of other problems.

Give a precise definition of an optimisation problem and of a solution of an instance of an optimisation problem. [5]

An optimisation problem O is defined as follows: • it consists of a set of instances I; • for every instance x ∈ I, there is a set of feasible solutions f(x); • for every instance x ∈ I and for every feasible solution y ∈ f(x), there is a value v(x,y) ∈ N = {0,1,2,...} giving the measure of the feasible solution y for the instance x; and • there is a goal which is either min or max. TSP

What is an independent set in a graph? What is the Independent Set (optimisation) problem? [3]

AnindependentsetUinagraphG=(V,E)isasubsetU⊆V of vertices so that no vertex in U is joined by an edge to any other vertex of U. Finding the maximum independent set in a graph. Check if correct??

What is the real-world register allocation problem? Explain how we might abstract this problem as a graph colouring problem. [4]

Can we decide whether every program variable can be assigned to one of our k registers so that if two program variables are in use at the same time then they are necessarily assigned to different registers? The program variables are abstracted as vertices and two vertices are joined by an edge if the corresponding program variables are in use at the same time. There is an allocation of program variables to k registers so that if any two program variables are in use at the same time then they have to be allocated to different registers if, and only if, the corresponding graph can be coloured using k colours.

What is the real-world frequency assignment problem? Explain how we might abstract this problem as a graph colouring problem. [4]

Consider a network of radio transmitters, each of which must be as- signed one of f operating frequencies. If two nearby transmitters are operating on the same frequency then they have the potential to inter- fere with each other. The frequencies assigned to such pairs of trans- mitters are required to be distinct. Can we decide whether we can allocate a frequency, from a set of f frequencies, to every transmitter so that any pair of nearby transmitters must have different frequencies? The transmitters are abstracted as ver- tices and two vertices are joined by an edge if the corresponding trans- mitters are nearby each other. There is an assignment of f frequencies to transmitters so that any two nearby transmitters necessarily broad- cast on different frequencies if, and only if, the corresponding graph can be coloured using f colours.

What do we mean by a brute-force algorithm to decide whether a graph can be coloured with 4 colours? [2]

It tries every single combination of 4 colours on all the nodes and check if it is an acceptable matching.

What is the Graph 3-Colouring (decision) problem and what is the Graph Colouring (optimisation) problem? [4]

Optimisation is what is the smallest number of colours required to properly colour this graph, 3 colour is, can we colour this using 3 colours.

What is the real-world scheduling problem? Explain how we might abstract this problem as a graph colouring problem. [4]

Suppose that you have a set of jobs that need to be allocated to t (equal length) time-slots. Jobs can be scheduled in any time-slot but some pairs of jobs are in conflict as they cannot be scheduled in the same time-slot. Can we decide whether there is a schedule for the jobs so that the number of time-slots is at most t? The jobs are abstracted as vertices and two vertices are joined by an edge if the corresponding jobs are in conflict. There is a schedule of the jobs in t slots so that no conflicting jobs occupy the same slot if, and only if, the corresponding graph can be coloured using t colours

What is the essential rule to bear in mind when developing an abstraction of a real-world problem? [2]

We only need the essential information, no duplicate information is required.

What is the real-world map-colouring problem? Explain how we might abstract this problem as a graph colouring problem. What is a planar graph? Explain how planar graphs and maps are related. Is every graph a planar graph? [8]

You are given a map with many regions each in a continuous border. A pair of regions may not share any part of their border, share one point but don't touch, share a part of their border. Can you colour the regions of the map with 3 colours so that if any two regions touch then they must be coloured differently? You can use nodes to represent regions and edges to show which regions share a part of their border. A planar graph is one that can be drawn with no edges overlapping each other. It turns out that not every graph corresponds to a map. Kuratowski's Theorem tells us the relationship. o two edges overlap, if, and only if, no subgraph can be obtained from the graphs K3,3 or K5 by sub-dividing edges, where a sub-division of an edge is the placement of a new vertex on it. No not every graph is a planar graph. For example:

Give a precise definition of a decision problem. [2]

a decision problem D consists of: • a set of instances I; and • a subset Y ⊆ I of yes-instances

What is a crown graph on 2n vertices? What is the smallest number of colours that can be used so as to obtain a proper colouring of the crown graph? [4]

a graph with 2 sets of nodes, where each node from each set is connected to each other. 2 colours is optimal

What is the real-world travelling salesman problem? Explain how this problem is usually abstracted so that it is amenable to computational solution. Illustrate how this abstraction might not be in keeping with reality. [5]

a salesman wishes to compute the shortest tour of a given collection of cities so as to save time or fuel, finishing at city where he starts. It is abstracted to a graph problem, where cities are nodes and the potential routes are nodes connected via edges, with weights of distances between them. In reality, the time taken will need to be modelled using traffic conditions and not just distance. There is a tradeoff between the quality of the solution and the complexity of arriving at the solution.

Give a graph where as to how you implement your greedy algorithm, above, matters; that is, where when different possible choices for putting some vertex in your independent set yields independent sets of different size. [8]

cba

Outline a greedy algorithm for finding a tour in a given collection of cities. Does your algorithm solve the Travelling Salesman (optimisa- tion) problem (optimally)? (If so then you should explain why; if not then you should provide a counter-example.) Show how your algorithm proceeds on the following instance of the Travelling Salesman problem (the city names are in bold and the distances between 2 cities are given in the table): [10] 01234567 0 0 4 11 23 3 6 2 2 140444544 2 2 4 0 12 1 13 3 3 3 32 4 11 0 2 3 4 5 4 10 8 1 12 0 7 6 9 5 2 2 2 22 11 0 6 7 645956508 7 3 5 4 6 9 10 7 0

cba

Outline a greedy algorithm for finding an independent set in a graph. Does your algorithm solve the Independent Set (optimisation) problem (optimally)? (If so then you should explain why; if not then you should provide a counter-example.) Show how your algorithm proceeds on the graph in Fig. 1. [10]

cba

Outline a real-world application of finding independent sets in graphs (you should explain clearly how finding independent sets is related to solving the real-world problem). [5]

cba

Give three different notions relating to general problem solving that are key concerns in Computer Science? [3]

computation, resource, correctness

What is the difference between a maximum independent set and a maximal independent set in a graph? [2]

not sure

Explain how there is always a decision problem corresponding to any search problem. [1]

there is always a decision problem corresponding to a search problem S = (I, J, R): • the decision problem has the same set of instances I; and • the yes-instances are those instances x ∈ I for which there exists some y ∈ J for which (x, y) ∈ R.

Suppose that we are given two lists of symbols (possibly of different lengths). Explain how we order these two lists according to the lexicographic ordering. [3]

• we compare two lists by working down the lists entry by entry until two corresponding entries differ; • the list with the least entry (we assume that there is some ordering on the entries) is deemed to be the least of the two lists; • if we never find two different corresponding entries but run out of one of the lists then this shortest list is the least list (note that in this case, the shorter list is a prefix of the longer one).


Conjuntos de estudio relacionados

Vállalatgazdaságtan 14 kérdés

View Set

PCM - Approach to Pediatric Physical Examination (04/26/18)

View Set

OT Final Exam: Book Themes and Classifications

View Set

APES Chapter 9: Industrial and Sustainable Agriculture Practices

View Set