Rabu, 17 November 2021

Latihan Soal

TERDAPAN SUATU INFORMASI BERIKUT :

Chris | Jones | C#
Mia | Smith | PHP
Chris | Jones | Java
Peter | Jones | C#
Sophia | Wilson | Java
Mia | Wilson | C#
Mia | Smith | C#

Terdapat Data sekelompok siswa dan nama kursusnya.
1. Buatlah code nya (pseudocode atau php atau python atau java) 
2. Gunakan Table Hash sesuai nama kursus dan urutkan namanya, 
3. Cetak outputnya.

JAWABAN :
=========

#include<bits/stdc++.h>
using namespace std;

class Hash
{
int BUCKET; 
list<string> *table;
public:
Hash(int V); 
void insertItem(int x, string key, string key2, string program);
void displayHash();
};

Hash::Hash(int b)
{
this->BUCKET = b;
table = new list<string>[BUCKET];
}
void Hash::insertItem( int number, string key, string key2, string program)
{
int index = nomor;
table[index].push_back(key);
table[index].push_back(key2);
table[index].push_back(program);
}

// function to display hash table
void Hash::displayHash() {
for (int i = 0; i < BUCKET; i++) {
cout << i;
for (auto x : table[i])
cout << " --> " << x;
cout << endl;
}
}

int main()
{

Hash h(7); 
h.insertItem(0, "Chris", " Jones", "C#");
h.insertItem(1, "Mia", " Smith", "PHP");
h.insertItem(2, "Chris", " Jones", "Java");
h.insertItem(3, "Peter", " Jones", "C#");
h.insertItem(4, "Sophia", " Wilson", "Java");
h.insertItem(5, "Mia", " Wilson", "C#");
h.insertItem(6, "Mia", " Jones", "C#");

h.displayHash();

return 0;
}


OUTPUT :



AM-receiver-using-ZN414



Notes.

  • Assemble the circuit on a good quality PCB.
  • The circuit can be powered from a 1.5V cell.
  • Do not give more than 1.8V to the circuit as it will destroy the IC.
  • For L1 make 80 turns of 0.3mm enameled copper wire on a 5cm long ferrite rod.
  • K1 can be a high impedance crystal earpiece.