Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 18 pages
Summary

Summary of A-Level Computing algorithms

Document preview thumbnail
Preview 3 out of 18 pages

All of the algorithms students need for their A-Level exam- both the pseudocode and Python code. Sorting and searching algorithms are covered in detail and fully commented.

Content preview

Computer Science A-Level Notes


Binary Search
function binary_search (items, search_item, first, last)

if first > last then

return -1

else

midpoint = (first + last) DIV 2

if items[midpoint] == search_item then

return midpoint

else if search_item > items[midpoint] then

first = midpoint + 1

return binary_search (items, search_item, first, last)

else

last = midpoint - 1

return binary_search (items, search_item, first, last)

endif

endif

endfunction




Elliot Tierney Page 1

, Computer Science A-Level Notes


Binary Tree (Search)
function binary_tree_search (node, search_item)

if search_item == node.data then

return True

elseif search_item > node.data and node.right != Null then

return binary_tree_search (node.right, search_item)

elseif search_item < node.data and node.left != Null then

return binary_tree_search (node.left, search_item)

endif

return False

endfunction




Elliot Tierney Page 1

, Computer Science A-Level Notes


Bubble Sort
procedure bubble_sort(items)



#Initialise variables

num_items = items.length

temp = 0



#Pass through list n-1 times

for pass_number = 1 to num_items - 1

for index = 0 to num_items - 2

#Check if items are out of order

if (items[index] > items[index + 1]) then

#Swap items

temp = items[index]

items[index] = items[index + 1]

items[index + 1] = temp

endif

next index

next pass_number



endprocedure




Elliot Tierney Page 1

Document information

Study Level
Subject
Uploaded on
March 21, 2022
Number of pages
18
Written in
2021/2022
Type
Summary
$6.96

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Sold
14
Followers
14
Items
84
Last sold
2 year ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions