Back - Solutions Index | Previous - Exercise 2 - Functions | Next - Exercise 4 - Relations


Solutions to Exercise 3 - Sequences

 

Question 1

home == ë14,DEE,ST,STRANOCUM,BT54,2DJì

home õ term = ë14,DEE,ST,STRANOCUM,BT54,2DJ,PENTLAND,HWU,CAMPUS,EDINBURGH,EH14,4ASì

rev term = ë4AS,EH14,EDINBURGH,CAMPUS,HWU,PENTLANDì

head term = ëPENTLANDì

front term = ëPENTLAND,HWU,CAMPUS,EDINBURGH,EH14ì

tail term = ëHWU,CAMPUS,EDINBURGH,EH14,4ASì

squash term = ëDEE,ST,STRANOCUM,PENTLAND,HWU,CAMPUS,EDINBURGHì

squash term ß {GLASGOW,EDINBURGH,ABERDEEN,DUNDEE} = ëEDINBURGHì

 

Question 2

(# sys1 ò # sys2 ΄ nqueue = sys1 õ sys2) ™ (# sys1 < # sys2 ΄ nqueue = sys2 õ sys1)

 

Question 3

RETURN(the number of entries in a queue)

RETURN(the number of queues which are empty)

REMOVE(a specified file from a queue)

REMOVE(all files from a specified queue and add them to the end of another queue)

MOVE(a file from a queue and place it at the end of another queue)

RETURN(the total number of queues with at least one file contained therin)