Collections
A geography teacher is searching CITIES. The city names are stored in a collection called CITES. The teacher just wishes to print out the names of the cities beginning with D.
TASK1: Construct pseudo code algorithm ( using correct IB notation ) to indicate how this can be achieved. Please post your answer to Google Classroom
Stacks LIFO: last in first out
Great for parsing / checking syntax Rules
Given a string: “hello (hello is a greetng [sic] {“sic” is used when quoting a text that contains a typo (or archaic [and nowadays wrong] spelling) to show that the mistake was in the original text (and not introduced while copying the quote)})”
The string to parse is held in a collection of letters called LETTERS and you can use associated commands.
Two arrays exist that contain OPENBRACKETS[ [, ( ,{, ] CLOSEBRACKETS[ ], }, ) ]
MYSTACK is a stack initially empty and you may use MYSTACK.push() , MYSTACK.pop() , MYSTACK.isEmpty()
Updated TASK2: Construct a solution in both psudeo code and as a flow chart ( using correct IB notation ) and post to google classroom the algoritm will :
Check that all brackets match:
● Every opening bracket has a closing bracket
● Every closing bracket has an opening bracket
● Nested brackets match up: no “([)]”!
for flow chart use google draw or flowgorithm.org
Queues FIFO: first in first out
Controlling access to shared resources in an operating system, e.g. a printer queue
A queue of requests in a web server
(Stacks and queues both appear when an algorithm has to remember a list of things to do)
Further Reading ( if needed ) click here