Logo 
Search:

Artificial Intelligence Articles

Submit Article
Home » Articles » Artificial Intelligence » ProLogRSS Feeds

PROLOG PROGRAM TO FIND THE PERMUTATION OF THE GIVEN LIST

Posted By: Milind Mishra     Category: Artificial Intelligence     Views: 6499

PROLOG PROGRAM TO FIND THE PERMUTATION OF THE GIVEN LIST.

Code for PROLOG PROGRAM TO FIND THE PERMUTATION OF THE GIVEN LIST in Artificial Intelligence

trace
domains
    list = symbol*
predicates
    del(symbol,list,list)
    permute(list,list)
clauses
    del(X,[X|L1],L1).
    del(X,[Y|L1],[Y|L2]):-
        del(X,L1,L2).
    permute([],[]).
    permute(L,[X|P]):-
        del(X,L,L1),
        permute(L1,P).


Output : 

Goal: permute([a,b,c],P)

P=["a","b","c"]
P=["a","c","b"]
P=["b","a","c"]
P=["b","c","a"]
P=["c","a","b"]
P=["c","b","a"]
6 Solutions
Goal:
  
Share: 


Didn't find what you were looking for? Find more on PROLOG PROGRAM TO FIND THE PERMUTATION OF THE GIVEN LIST Or get search suggestion and latest updates.

Milind Mishra
Milind Mishra author of PROLOG PROGRAM TO FIND THE PERMUTATION OF THE GIVEN LIST is from India.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!