Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct node *od_x_do_y(struct node *head, int x, int y){
- if (head != NULL && head->next != NULL)
- {
- struct node *znajdzx = head;
- struct node *znajdzy = head;
- struct node *tail = head;
- struct node *p;
- while (tail->next != NULL) tail = tail->next;
- while (znajdzx != NULL){
- if (znajdzx->val == x){
- while (znajdzy != NULL){
- if (znajdzy->val == y){
- while (znajdzx->next != znajdzy){
- p = znajdzx->next;
- znajdzx->next = p->next;
- p->next = tail->next;
- tail->next = p;
- tail = p;
- }
- return;
- }
- else znajdzy = znajdzy->next;
- }
- }
- else znajdzx = znajdzx->next;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement