Question: 8.1 Procedures sub1, sub2 and sub3, shown below, all implement the sublist relation. subl is a more procedural definition whereas sub2 and sub3 are written

8.1 Procedures sub1, sub2 and sub3, shown below, all implement the sublist relation. subl is a more procedural definition whereas sub2 and sub3 are written in a more declarative style. Study the behaviour, with reference to efficiency, of these three procedures on some sample lists. Two of them behave nearly equivalently and have similar efficiency. Which two? Why is the remaining one less efficient? sub1( List, Sublist) :- prefix( List, Sublist). sub1(Tail], Sublist) :- subl(Tail, Sublist). prefix([]). prefix( [X | List1], [X | List2]):- prefix( List1, List2). % Sublist is sublist of Tail sub2( List, Sublist) :- conc( List1, List2, List), conc( List3, Sublist, List1). sub3( List, Sublist) :- conc( List1, List2, List), conc( Sublist,, List2).

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Management And Artificial Intelligence Questions!