• Tekshirdi: Muxsinov Shamil Shavkatovich
  • Tekshirdi: Muxsinov Shamil Shavkatovich




    Download 0,78 Mb.
    Sana13.02.2024
    Hajmi0,78 Mb.
    #155582
    Bog'liq
    2-laboratoriya ishi


    O‘ZBEKISTON RESPUBLIKASI RAQAMLI TEXNOLOGIYALAR VAZIRLIGI
    MUHAMMAD AL-XORAZMIY NOMIDAGI TOSHKENT AXBOROT TEXNOLOGIYALARI UNIVERSITI

    Komyuter injinerligi fakulteti 215-20 guruh talabasi


    Raxmatov Navro’zbeking Ma‘lumotlar tuzilmasi va algoritmlar fanidan
    2-amaliy ish.

    Tekshirdi: Muxsinov Shamil Shavkatovich

    Toshkent-2023


    2-tajriba ishi. QIDIRUV USULLARINI TADQIQ QILISH

    Ishdan maqsad: talabalar berilgan tuzilmaning shakliga qarab biror kalitga mos elementni qidirishning optimal usulini qo’llashni o’rganishlari va qidiruv usullarining samaradorligini taqqoslashlari kerak.

    Ro‘yhatda transpozitsiya usuli yordamida toq elementlarni topish dasturini tuzing.


    #include
    #include

    using namespace std;


    vector> transposeMatrix(const vector>& matrix) {


    int rows = matrix.size();
    int cols = matrix[0].size();

    vector> transposed(cols, vector(rows));


    for (int i = 0; i < rows; ++i) {


    for (int j = 0; j < cols; ++j) {
    transposed[j][i] = matrix[i][j];
    }
    }

    return transposed;


    }

    void printMatrix(const vector>& matrix) {


    for (const auto& row : matrix) {
    for (int element : row) {
    cout << element << " ";
    }
    cout << endl;
    }
    }

    void findOddElements(const vector>& matrix) {


    cout << "Odd elements in the matrix after transpose:" << endl;
    for (const auto& row : matrix) {
    for (int element : row) {
    if (element % 2 != 0) {
    cout << element << " ";
    }
    }
    }
    cout << endl;
    }

    int main() {


    vector> matrix = {
    {1, 2, 3},
    {4, 5, 6},
    {7, 8, 9}
    };

    cout << "Original matrix:" << endl;


    printMatrix(matrix);

    vector> transposed = transposeMatrix(matrix);


    cout << "Transposed matrix:" << endl;


    printMatrix(transposed);
    findOddElements(transposed);

    return 0;


    }











    Xulosa:
    Bizdan soralgan qidiruv usuli yordamida masalani yechdik va qidiruv usullari haqida malumotlarga ega boldik

    Download 0,78 Mb.




    Download 0,78 Mb.

    Bosh sahifa
    Aloqalar

        Bosh sahifa



    Tekshirdi: Muxsinov Shamil Shavkatovich

    Download 0,78 Mb.