⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fig9_3.pl

📁 超多的prolog源代码 具体内容见压缩包里面的programs.txt
💻 PL
字号:
% Figure 9.3  A more efficient implementation of quicksort using difference-pair
% representation for lists. Relation split( X, List, Small, Big) is as defined 
% Figure 9.2.


% quicksort( List, SortedList): sort List with the quicksort algorithm

quicksort( List, Sorted)  :-
  quicksort2( List, Sorted - [] ).

% quicksort2( List, SortedDiffList): sort List, result is represented as difference list

quicksort2( [], Z - Z).

quicksort2( [X | Tail], A1 - Z2)  :-
   split( X, Tail, Small, Big),
   quicksort2( Small, A1 - [X | A2] ),
   quicksort2( Big, A2 - Z2).

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -