



































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




































What is computational thinking? - ANS The ability to think logically about a problem in a way a computer can execute it and apply techniques for solving it using a set of problem solving methods. Why is computational thinking important? - ANS As many overarching problems are very difficult to understand What is the aim of computational thinking? - ANS To be able to make an overarching problem understood and then formally represented and solved What does computational thinking require? - ANS Computational thinking requires algorithmic thinking What stages does algorithmic thinking require? - ANS - Understanding the problem
If problem the abstract model is representing can be solved using a computer program what must you then need to consider? - ANS - What are the key features of the problem
Give examples of preconditions that can be specified within documentation - ANS - Requirements for the specification specification the device to be able to run the program
What are the advantages of reusing pre-written components - ANS The advantages of reusing pre- written components:
Give an example of how a choice of loop can drastically change the output of a program? - ANS A repeat loop always executes at least once while a while loop may never have to run if the initial condition isn't met What user involved decisions may need to be considered when developing software? - ANS - Identify where the user will need to make decisions
What does genuine parallel processing require? - ANS Multi core processors. Parallel processing can have significant benefits if problem is suited to being broken down into modules that can be processed simultaneously though time and processing power may be taken up in deciding which tasks can be split up and the reassembly of multiple threads In a single core processor, how the may the illusion of parallel processing be given? - ANS Giving a small time slice to each tasks int he processor meaning that tasks are being completed sequentially but appear simultaneously What is an algorithm? - ANS An algorithm is a sequence of unambiguous rules and instruction used for solving or completing a specific task What type of representation is an algorithm and what is the advantage of this? - ANS An algorithm is a generalised representation so can be used for similar problems and a wide range of inputs What must occur to combat the fact that many different algorithms can solve the same problem? - ANS Algorithms must be compared too determine which is most suitable by looking at the best and worst case scenarios for both types of complexity What are the two complexities algorithms differ in? - ANS Algorithms differ in:
What is logarithmic complexity and give an example? - ANS Logarithmic complexity involves the rate of complexity increase decreasing as the data set increases and has a good efficiency as very scalable Can be seen in divide and conquer techniques such as binary search (quick and merge sort are divide and conquer but are linearithmic) Give a log graph What is linear complexity? - ANS Linear complexity is where complexity is directly proportional to data set size Has a fair efficiency Seen in standalone loops such as linear search Gives a diagonal straight line graph passing through origin (direct proportion) What is polynomial complexity? - ANS Polynomial complexity is when complexity is proportional to the size of the data set rated to the exponent (usually 2) --> Usually when nested loops occur (n^loops) such as bubble and insertion sorts
if found == true then print("Item found at position " + count) else print("item not found") What are the advantages of linear searches? - ANS + Simple to code and implement
What is a binary search? - ANS A binary search is a searching algorithm utilising a divide and technique for ordered data sets by repeatedly dividing the data se tin two and eliminating the half in which the search item is not located until it is found. Give the code for a binary search - ANS items.Sort // any appropriate sorting algorithm found = false Lbound = 0 UBound = items.length- input(searchItem) While Lbound <= Ubound AND found == false mid = (LBound + Ubound) DIV 2 if items[mid] == searchItem then found = true else if items[mid]<searchItem then Lbound = mid + else UBound = mid - End If End If End While If found == true print ("Item found at position " + midpoint) else
What is the space complexity for a binary search and why? - ANS O(1) as same working values What is another important factor to include when examining and comparing complexities with binary search? - ANS The sorting algorithm used will also have its own complexity What is a bubble sort? - ANS A bubble sort is a method of sorting data by comparing consecutive items in a data set and swapping them if necessary. Once the algorithm reaches the end of the data set, it returns to the beginning and repeats the process until a pass through the data set is completed without a swap being made Carry out a bubble sort upon the following data set leaving a space between each pass {Goofy, Pluto, Donald, Minnie, Mickey} using brackets to show comparisons - ANS [Goofy Pluto] Donald Minnie Mickey Goofy [Pluto Donald] Minnie Mickey Goofy Donald [Pluto Minnie] Mickey Goofy Donald Minnie [Pluto Mickey] Goofy Donald Minnie Mickey Pluto // Result at end of Pass 1 [Goofy Donald] Minnie Mickey Pluto Donald [Goofy Minnie] Mickey Pluto Donald Goofy [Minnie Mickey] Pluto Donald Goofy Mickey [Minnie Pluto] Donald Goofy Mickey Minnie Pluto//Result at end of Pass 2 [Donald Goofy] Mickey Minnie Pluto Donald [Goofy Mickey] Minnie Pluto Donald Goofy [Mickey Minnie] Pluto
Donald Goofy Mickey [Minnie Pluto] Donald Goofy Mickey Minnie Pluto // No swaps made in Pass 3 so sorted list returned What can be said about the bubble sort at the end of each pass? - ANS At the end of each pass, the largest unsorted item will be sorted in its appropriate place at the end of the data set. Give the code for a bubble sort? - ANS swapped = true while swapped == true swapped = false for count = 0 to items.Length - if items[count] > items[count+1] temp = items[count] items[count] = items[count+1] items[count+1] = temp swapped = true End if Next count End while What are the advantages of bubble sort? - ANS + Good on small data sets