The Student Room Group

GCSE Computer Science QUESTION

Do I need to learn the pseudocodes for linear and binary search off by heart?
e.g. Binary Search

data_set = [2, 4, 5, 6, 9, 21, 50, 77, 91]
data_set_length = 9
search_criteria = 50
LB = 0
UB = data_set_length - 1
match = false

WHILE match == false AND LB != UB
MidPoint = roundup((UB - LB)/2) + LB
IF data_set[MidPoint] == search_criteria THEN
match = true
ELSE IF data_set[MidPoint] < search_criteria THEN
LB = MidPoint + 1
ELSE
UB = MidPoint - 1
END IF
END WHILE

IF match == true THEN
PRINT 'Match found'
ELSE
PRINT 'Match not found'
END IF


Thanks
Original post by funim
Do I need to learn the pseudocodes for linear and binary search off by heart?
e.g. Binary Search

data_set = [2, 4, 5, 6, 9, 21, 50, 77, 91]
data_set_length = 9
search_criteria = 50
LB = 0
UB = data_set_length - 1
match = false

WHILE match == false AND LB != UB
MidPoint = roundup((UB - LB)/2) + LB
IF data_set[MidPoint] == search_criteria THEN
match = true
ELSE IF data_set[MidPoint] < search_criteria THEN
LB = MidPoint + 1
ELSE
UB = MidPoint - 1
END IF
END WHILE

IF match == true THEN
PRINT 'Match found'
ELSE
PRINT 'Match not found'
END IF


Thanks


Check the specification and see if they require you to learn the algorithm.

You shouldn't have to remember any specific syntax/lines of code if you actually understand what linear and binary search does.
Original post by funim
Do I need to learn the pseudocodes for linear and binary search off by heart?

No - Computer Science is all about having skills in problem solving and understanding the underlying concepts, so in the case of algorithms, you just need to understand how a particular algorithm works. CompSci isn't really a "knowledge"-based subject, it's a lot deeper than that - it's based very heavily around having the skills and gaining a full understanding of concepts.

Psuedocode is just a Plain-English Language way of being able to express those concepts, so if you're ever trying to memorise pseudocode then you're doing something wrong!

Don't spend (waste) time trying to memorise pseudocode, instead use your time wisely so that you're confident with those algorithms at a conceptual level, and make sure you're confident in thinking computationally as well so that you can cope with absolutely any exam question which comes along for writing pseudocode to solve a problem.

There's a proverb: "Give a man a fish, he'll feed himself for a day. Teach a man to fish and he'll feed himself for the rest of his life". Learning the concepts and knowing the mindset of problem solving is like the proverbial 'learning to fish'.


I believe the exam boards usually provide a pseudocode reference in the exam so that you don't need to memorise the syntax either.
(edited 5 years ago)
Reply 3
interesing

Quick Reply

Latest

Trending

Trending