Skip to content

Instantly share code, notes, and snippets.

@danielgospodinow
Created January 1, 2020 19:29
Show Gist options
  • Save danielgospodinow/b3226e5cd416af7f55a52d8d68ff204c to your computer and use it in GitHub Desktop.
Save danielgospodinow/b3226e5cd416af7f55a52d8d68ff204c to your computer and use it in GitHub Desktop.
First task from the first DSP exam 2019/2020 (81786)
void fillgaps(node<int>* l) {
if(l == nullptr) {
return;
}
node<int>* current = l;
while (current->next != NULL)
{
if (current->data != (current->next->data - 1))
{
node<int>* neww = new node<int>();
neww->data = current->data + 1;
neww->next = current->next;
current->next = neww;
}
current = current->next;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment