Edexcel curriculum (2015)
PythonBinary/HexData representationCompressionEncryptionWhat is a computer?Working computerHardwareOperating systemComputer processesThe CPUMemoryInput devicesOutput devicesData storageInside the CPUStored programF-D-E cycleCPU componentsNetworksLAN, WAN and PANNetwork topologiesNetwork addressingProtocolsError detectionThe internetThe world wide webHTML and CSSClient-server modelVPNsSQLImpactEthical issuesMicrocontrollersComp modelsEmerging trendsVirtual machinesModels and simsAlgorithms |
Algorithms What is an algorithm?
• A precisely stated, step by step list of instructions to carry out a task. • All algorithms consist of a combination of sequences, selection and repetition. Is there an algorithm to making a jam sandwich? Count occurrence
Mark Sheet Scenario •There are 30 students in a class. •Each student has taken a test with 20 questions. •The marks achieved are: •2, 6, 8, 14, 18, 6, 15, 7, 6, 17, 12, 6, 15, 19, 20, 3, 15, 6, 3, 18, 6, 2, 13, 10, 19, 5, 6, 7, 16, 18. •How many people gained a mark of 6? •What process did you go through to work this out? PSEUDOCODE
•SET item TO 0 •SET occurrences TO 0 •SET mark TO 6 •SET list TO [2, 6, 8, 14, 18, 6, 15, 7, 6, 17, 12, 6, 15, 19, 20, 3, 15, 6, 3, 18, 6, 2, 13, 10, 19, 5, 6, 7, 16, 18] •SET lengthOfList TO 30 •WHILE item <=lengthOfList –IF list[item-1] == mark THEN –SET occurrences TO occurrences + 1 –END IF –SET item TO item +1 •END WHILE Python challenge
Above is the psedocode for the algorithm that counts the number of 6s in the list of numbers. Can you write the python code to create a program which counts how many 6s occur? Submit your code using the link at the top right. Working out the mean
How do you go about working out the mean from the following list of numbers? 2, 6, 8, 14, 18, 6, 15, 7, 6, 17, 12, 6, 15, 19, 20, 3, 15, 6, 3, 18, 6, 2, 13, 10, 19, 5, 6, 7, 16, 18. Pseudocode
•SET item TO 1 •SET total TO 0 •SET list TO [2, 6, 8, 14, 18, 6, 15, 7, 6, 17, 12, 6, 15, 19, 20, 3, 15, 6, 3, 18, 6, 2, 13, 10, 19, 5, 6, 7, 16, 18] •SET lengthOfList TO len(list) •WHILE item <=lengthOfList –total = total + list[item-1] –Increment item by 1 –END WHILE •MEAN = Total divided by Length of List •Print Mean Python challenge
Above is the pseudocode for the algorithm that works out the mean in the list of numbers. Can you write the python code to create a program which works out the mean? Submit your code using the link at the top right. A guide that explaies looping through a list can be found here A guide to help you with the code can be found here Bubble sort algorithm
The contacts list in our mobile phone is a list that is ordered alphabetically. How does our mobile phones store our contacts in alphabetical order? Bubble sort, sometimes referred to as sinking sort, is a simple sorting algorithm that repeatedly passes through the list to be sorted. In a single pass, the sorting occurs by a comparison of each pair of adjacent items and swaps them if they are in the wrong order.
Python challenge - Bubble sort
|