Create Time: 4th March 2024
Title: "[[Tutorial-1]]"
Author:
- AllenYGY
status: DONE
tags:
- NOTE
- DAA
- Tutorial
created: 2024-03-04
updated: 2024-04-09T00:27
Given the problem: “For the given positive integer, justify if it is a prime.”
Formally define the problem
Give some instances and corresponding outputs
3. Construct an algorithm and describe it with/without using pseudo code
Algorithm Quicksort
procedure Quicksort(A,p,r)
if p<r then
q= Partition(A,p,r)
Quicksort(A,p,q−1)
Quicksort(A,q+1,r)
end if
end procedure
procedure Partition(A,p,r)
x=A[r]
i=p−1
for j=p to r−1 do
if A[j]<x then
i=i+1
exchange A[i] with A[j]
end if
exchange A[i] with A[r]
end for
end procedure