check if a list is sorted using prolog

  Рет қаралды 20,968

Techdose

Techdose

Күн бұрын

Пікірлер
@shubhammandal789
@shubhammandal789 5 жыл бұрын
thanks for making this videos on prolog ,i just need it for my exams
@techdose4u
@techdose4u 5 жыл бұрын
Welcome :)
@CSBAjay
@CSBAjay 4 жыл бұрын
Sir u just nailed it , thank u so much sir
@techdose4u
@techdose4u 4 жыл бұрын
Welcome :)
@VADroidTS555
@VADroidTS555 4 жыл бұрын
Thank you!
@techdose4u
@techdose4u 4 жыл бұрын
Welcome
@m_stifeev
@m_stifeev 4 жыл бұрын
How can we deal with the problem, that we can't compare X using '=
@m_stifeev
@m_stifeev 4 жыл бұрын
In PC version of SWI-interpretator this is the problem.
@techdose4u
@techdose4u 4 жыл бұрын
@@m_stifeev Can't we write a stopping condition at the start of the recursion call that if any or both are empty then return a required value?
@m_stifeev
@m_stifeev 4 жыл бұрын
@@techdose4u thanks for answering, but finally I found better solution: is_sorted([]):- !. is_sorted([_]):- !. is_sorted([A,B|T]):- A =< B, is_sorted([B|T]).
@VADroidTS555
@VADroidTS555 4 жыл бұрын
@@m_stifeev in pure prolog style of programming, ! Isn't used.
@shikasi
@shikasi 2 жыл бұрын
There is a problem with this program, which is that you cannot use a variable in the terminal to check for all the values of the variable for which the program results in true.
@darshanhr1213
@darshanhr1213 3 жыл бұрын
How to check for the String list ?
@shuvranilsanyal445
@shuvranilsanyal445 3 жыл бұрын
How to check if it is ascending or descending?
@SamanviKhushi
@SamanviKhushi 4 жыл бұрын
Hello sir, can you help me in understanding this query. should i first sort and then check whether its sorted or not. or just check. Write a predicate sortedList/2 that is true if the second list is the first list sorted. You may of course not use any built-in sorting procedures, but you can use commands like delete/3 and min/2. Hint: First write a predicate smallestElement(Xs,X) that is true if X is the smallest element in X. Ex : ?-sortedList([2,1,3],[1,2,3]). true
Append and Concatenate in prolog
8:32
Techdose
Рет қаралды 35 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Chain Game Strong ⛓️
00:21
Anwar Jibawi
Рет қаралды 41 МЛН
Find if given element is present in list using prolog
5:41
Techdose
Рет қаралды 43 М.
Find if Array Can Be Sorted - Leetcode 3011 - Python
16:35
NeetCodeIO
Рет қаралды 9 М.
Prolog 2: Lists and matching/equalities
17:01
EducationAboutStuff
Рет қаралды 25 М.
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
Trump announced the end date of the war / Emergency plane landing
14:05
L10. Check if a LinkedList is Palindrome or Not | Multiple Approaches
20:02
Prolog List : How to add/delete item from prolog list
25:11
Algorithms
Рет қаралды 3,3 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 846 М.
Find number of elements in a list in prolog (with CODE)
8:51
Prolog - Programming Facts, Rules, Queries
12:03
TutorialsPoint
Рет қаралды 104 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН