Abdullayev Muhammadamin swd001 2-Amaliy mashg’ulot Mavzu


Download 7.06 Kb.
Sana28.10.2023
Hajmi7.06 Kb.
#1730087
Bog'liq
mta22133


Abdullayev Muhammadamin SWD001
2-Amaliy mashg’ulot
Mavzu: QIDIRISH VA SARALASH ALGORITMLARI

  1. To’g’ridan-to’g’ri qo’shish usuli bilan saralash algoritmi(insertion sort)

  2. Tanlash orqali saralash algoritmi (Selection sort)

  3. Pufaksimon saralash algoritmi (Bubble sort)

  4. Chiziqli qidirish(linear search)

  5. Binar qidirish(binary search)

.
VARIANT-N1

  1. A massivning elementlarini to’g’ridan-to’g’ri qo’shish usuli bilan saralash algoritmidan foydalanib saralang va massivning eng katta elementini ekranga chiqarish dasturini tuzing


DASTUR KODI

#include

using namespace std;

int main()


{ int k, n=10,min;
int A[n]={4,2,8,0,5,3,9,1,7,6};
for(int i=0;imin=i;
for(int j=i+1;jif (A[j]}
if (min!=i) swap(A[i],A[min]);
}
cout<<"Massivning eng katta elementi="<return 0;
}
Download 7.06 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling