The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
476 views

http://www.gatecse.in/programming/

http://www.gatecse.in/data-structures/

Refer the above two links for the materials. Also do follow this blog for GATE 2017 (we won't be using moodle any more). I'll be adding some exercises as comments. Most exercises for this subject will be programming ones. 

posted Mar 17, 2016 in Programming & Data Structures by Veteran (357,485 points) | 476 views
0
Like
0
Love
0
Haha
0
Wow
0
Angry
0
Sad

3 Comments

1. Write a C function to reverse a linked list.
struct node {
int x;
struct node * next;

};
typedef struct node node;
node * reverse (node * list);

2.
int c,d;
int *a = &c,  *b = &d;

Write a C function to swap the values of a and b.
1.
node *reverse(node *list)
{
  node *prev , *current, *next;
  current=list;
  prev=NULL;
  while(current!=NULL)
  {
    next= current->next;
    current->next=prev;
    prev=current;
    current=next;
  }
list=prev;
return list;
}

2. void swap(int *a, int *b)
  {
     int temp;
     temp=*a;
     *a=*b;
     *b=temp;
}
In the first code why are you returning list? Can the function work with return void?
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

39,645 questions
46,729 answers
140,391 comments
58,088 users