Kichik massivlar uchun qo’shilgan saralash. Qo’shilgan saralash



Download 209 Kb.
bet3/3
Sana31.12.2021
Hajmi209 Kb.
#202736
1   2   3
Bog'liq
Lab1.2.

Dastur kodi:

#include

#include

#include

void GetArr(int Arr[],const int N)

{

srand(time(NULL));



for (int i=0;i

}

void Print(int Arr[],const int N)



{

for (int i=0;i

cout<<"\n";

}

void swapper(int &x,int &y)



{

int temp;

temp=x;

x=y;


y=temp;

}

void Sort(int Arr[],const int N)



{

for (int i=1;i

{

for (int j=0;j

{

if (Arr[j]>Arr[j+1]) swapper(Arr[j],Arr[j+1]);

}

}

}



int main()

{

system("CLS");



int N;

cout<<"elementlar soni:\n";

cin>>N;

int M[N];

GetArr(M,N);

cout<<"\nMassiv elementlari:\n";

Print(M,N);

Sort(M,N);

cout<<"\nSaralangan massiv elementlari:\n";

Print(M,N);

getch();

return 0;



}

Natija:



Talabalar mavzuni mustahkamlashi uchun qo’shimcha topshiriqlar.
Masalan, Pufakli saralash orqali qadamlar sonini aniqlash algebraic blok sxemasi va dastur kodini tuzing.


  1. (-1.2, -1.4, -2.3, -3.8, -1.6, -1.7, -1.0)

  2. (112, 114, 96, 67, 122, 119, 215)

  3. ( 20.44, 30.3, 20.8, 30.18, 20.64)

  4. (5, 3, 1, 4, 2, 6)

  5. (421/12, 112/14, 124/6, 421/7, 124/2, 4217/9, 185/15)

  6. (-0.2, 0.3, -10.124, -0.897, 0.00897, -9.4856)

  7. (50/3, 542/12, 779/46, 142/4, 512/2, 425/8, 420/4, 915/15)

  8. (-42.2, -44.1, -51.3, -84.8, -64.1, -75.1, -50.45)

  9. (12, 14, 6, 7, 2, 9, 15)

  10. (124.21, 142.5, 152.7, 124.1, 164.2, 140.8, 153.0, 153.9)

  11. (0.4, 0.3, 0.8, 0.1, 0.6)

  12. (3, 5, 7, 1, 2, 8, 0, 9)

  13. (0.022, 0.014, 0.016, 0.07, 0.122, 0.529, 0.015)

  14. (-10.4, -15.3, -11.4, -20.1, -17.6)

  15. (-1243, 124.5, 421.7, 165.1, 823.2, 421.8, 175.4, 564.9)

  16. (-24.1, -1.4, -21.3, -0.1248, -1.426, -0.127, 0.012)

  17. (-2, -4, -3, -8, -6, -7, 0)

  18. (-12,-14,-6,-7,-2,-9,-15)

  19. (-10.4, -10.3, -10.8, -10.1, -10.6)

  20. (0.003, 0.005, 0.007, 0.001, 0.002, 0.008, 0.001, 0.09)

  21. (1.3, 1.5, 1.7, 1.1, 2.2, 1.8, 1.0, 1.9)

  22. (-0.2, -0.4, -0.1, -0.60, -0.6, -0.17, -0.24)

  23. (1/12, 1/14, 1/6, 1/7, 1/2, 1/9, 1/15)

  24. (-0.2454, -0.1323, -0.4258, -0.4451, -0.126)

  25. (-3/2, -2/4, -4/3, -8/4, -6/5, -4/7, 0.4)

  26. (0.254, 0.323, 0.258, 0.451, 0.632)

Download 209 Kb.

Do'stlaringiz bilan baham:
1   2   3




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

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish