Muhammad al- xorazmiy nomidagi toshkent axborot texnalogiyalri unversiteti algorithm design



Download 32,65 Kb.
Sana02.06.2023
Hajmi32,65 Kb.
#948106
Bog'liq
algoritm3


O’ZBEKISTON RESPUBLIKASI AXBOROT KOMMUNIKATSIYA VA TEXNALOGIYALARINI RIVOJLANTIRISH VAZIRLIGI
MUHAMMAD AL- XORAZMIY NOMIDAGI
TOSHKENT AXBOROT TEXNALOGIYALRI UNVERSITETI



ALGORITHM DESIGN


3-Amaliy ish.

Topshirdi: Mahmudov M.


Qabul qildi: Begimov O
Guruh: CAL019-1

Toshkent - 2023


Variant-7









#DASTURI



#include
#include
using namespace std;
int main(){
float x[6]={0.41,0.46,0.52,0.6,0.65,0.72},y[6]={0.526,0.453,0.482,0.552,0.436,0.378},
x2[6],xy[6],ych[6],d[6],d2[6];
float SummaX=0,SummaY=0,SummaX2=0,SummaXY=0,Summaych=0,Summad2;
cout<<"x ";
for (int i=0;i<6;i++){
cout<SummaX+=x[i];
} cout<cout<for (int i=0;i<6;i++){
cout<SummaY+=y[i];
}cout<cout<for (int i=0;i<6;i++){
x2[i]=x[i]*x[i];
cout<SummaX2+=x2[i];
}cout<cout<for (int i=0;i<6;i++){
xy[i]=x[i]*y[i];
cout<SummaXY+=xy[i];
}cout<cout<float matrissa[2][3];
matrissa[0][0]=SummaX2;
matrissa[0][1]=SummaX;
matrissa[1][0]=SummaX;
matrissa[1][1]=6;
matrissa[2][0]=SummaXY;
matrissa[2][1]=SummaY;
for(int i=0;i<2;i++){
for(int j=0;j<3;j++){
cout<}
cout<}
float k;
k=matrissa[0][0]*matrissa[1][1]-matrissa[0][1]*matrissa[1][0];
cout<double matrissa2[2][2];
matrissa2[0][0]=matrissa[1][1]/k;
matrissa2[0][1]=-matrissa[1][0]/k;
matrissa2[1][0]=-matrissa[0][1]/k;
matrissa2[1][1]=matrissa[0][0]/k;
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
cout<}
cout<}
double s,c;
s=matrissa2[0][0]*matrissa[2][0]+matrissa2[0][1]*matrissa[2][1];
c=matrissa2[1][0]*matrissa[2][0]+matrissa2[1][1]*matrissa[2][1];
cout<cout<<"b ="<for (int i=0;i<6;i++){
ych[i]=s*x[i]+c;
cout<Summaych+=ych[i];
}cout<for (int i=0;i<6;i++){
d[i]=ych[i]-y[i];
cout<}cout<for (int i=0;i<6;i++){
d2[i]=d[i]*d[i];
cout<Summad2+=d2[i];
} cout<cout<return 0;
}


+










#PRIMA KODI
using System;

class PrimAlgorithm


{
static int V;

static int MinKey(int[] key, bool[] mstSet)


{
int min = int.MaxValue, minIndex = -1;

for (int v = 0; v < V; v++)


{
if (mstSet[v] == false && key[v] < min)
{
min = key[v];
minIndex = v;
}
}

return minIndex;


}

static void PrintMST(int[] parent, int[,] graph)


{
Console.WriteLine("Yol \tUzunlik");
for (int i = 1; i < V; i++)
{
Console.WriteLine(parent[i] + " - " + i + "\t" + graph[i, parent[i]]);
}
}

static void PrimMST(int[,] graph)


{
int[] parent = new int[V];
int[] key = new int[V];
bool[] mstSet = new bool[V];

for (int i = 0; i < V; i++)


{
key[i] = int.MaxValue;
mstSet[i] = false;
}

key[0] = 0;


parent[0] = -1;

for (int count = 0; count < V - 1; count++)


{
int u = MinKey(key, mstSet);
mstSet[u] = true;

for (int v = 0; v < V; v++)


{
if (graph[u, v] != 0 && mstSet[v] == false && graph[u, v] < key[v])
{
parent[v] = u;
key[v] = graph[u, v];
}
}
}

PrintMST(parent, graph);


}

static void Main()


{
V = 6;

int[,] graph = new int[,] {


{ 0, 8, 0, 0, 7, 10 },
{ 8, 0, 12, 0, 0, 11 },
{ 0, 12, 0, 11, 0, 0 },
{ 0, 0, 11, 0, 6, 0 },
{ 7, 0, 0, 6, 0, 9 },
{ 10, 11, 0, 0, 9, 0 }
};

PrimMST(graph);


}
}






#DASTURI
import java.util.*;

class Main


{
public static void main (String[]args)
{
Scanner input=new Scanner(System.in);
int n, count = 0;
System.out.print ("n = ");
n = input.nextInt ();

System.out.println ();


System.out.println ("Matrix elementlarini toping: ");


int matrixA[][] = new int[n][n];
for (int i = 0; i < matrixA.length; i++)
{
for (int j = 0; j < matrixA[i].length; j++)
{
matrixA[i][j] = input.nextInt ();
}
} for (int i = 0; i < matrixA.length; i++)
{
for (int j = 0; j < matrixA[i].length; j++)
{
if (matrixA[i][j] > 0)
{
count++;
}
}
}

System.out.println ();


System.out.println ("Grafning qirralar soni: " + count / 2);


System.out.println ();


System.out.println ("Tayanch daraxti grafning " + (n - 1) +


" ta qirrasini oz ichiga oladi.");
}
}

Download 32,65 Kb.

Do'stlaringiz bilan baham:




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