Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void delete(long keys){
- bool done = false; //zeby zaczac petle
- int index = keys%size; //indeks tworze
- while (done != true) { //konczy sie jak nie bedzie elementu do przesuniecia
- if (index == size) { //jesli konie tablicy lec od poczatku
- index = 0;
- }
- else { //jesli nie rob dlej
- if (tab[index].key == keys) { //jesli klucz rowna sie kluczowi do usuniecia to usun
- tab[index].exists = false;
- }
- else {
- //jesli nie to sprawdz kazdy element tablicy czy jest git do przeniesienia / jesli tak to przenies i usun
- for (int i = 0; i < size; i++) {
- if (tab[i].key%size == tab[index].key%size) {
- tab[i] = tab[index];
- tab[i].exists = true;
- tab[index].exists = false;
- }
- else {
- done = true; //brak elementu do przesuniecia = wyjscie
- }
- }
- }
- }
- index++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement