Posts

Good Tools for Research : Helpful Links

ShareLaTeX, and WriteLaTeX:  To draft a research paper in any format you wish with ease and share among collaborators while working. Link for ShareLaTeX Link for WriteLaTeX DropBox:  Keeping documents/papers etc at one place and sharing among the team members Link PDF Annotator: Easy to edit pdf at anytime Link Google Scholar:  Easy to find research papers relevant to my required keywords Link Plotly:  For creating / drawing graphs Link Mendeley: Reference Manager Link Animoto:  Video Maker Link EndNote: Make your library of whatever you search Link SmartDraw: Create diagrams and charts Link

Implementation of Stack

Implementatio in C: Using Array #include<stdio.h> #include<stdlib.h> struct stack {     int top;     unsigned capacity;     int* array; }; struct stack* create(unsigned capacity) {     struct stack* stack = (struct stack*)malloc(sizeof(struct stack));     stack->top = -1;     stack->capacity = capacity;     stack->array = (int*)malloc(capacity * sizeof(int));     return(stack); } int isFull(struct stack* stack) {     return(stack->top == stack->capacity - 1); } int isEmpty(struct stack* stack) {     return(stack->top == -1); } void push(struct stack* stack, int data) {     if(isFull(stack))         printf("Stack overflow");     stack->array[++stack->top] = data;     printf("\nPushed data on stack : %d\n",data); } int pop(struct stack* stack) {     if(isEmpty(...

Function to find Identical LinkedList

Implementation in C: #include<stdio.h> #include<stdlib.h> struct node { int data; struct node* next; }; void push(struct node** ref, int newData) {     struct node* newNode = (struct node*)malloc(sizeof(struct node));     newNode->data = newData;     newNode->next = (*ref);     (*ref) = newNode; } int identical(struct node* a,struct node* b) {     while(1)     {     if(a == NULL && b == NULL)         return 1;     if(a == NULL && b != NULL)         return 0;     if(a != NULL && b == NULL)         return 0;     if(a->data != b->data)         return 0;     a = a->next;     b = b->next;     } } int main() {     struct node* a = NULL;     struct node* b = NULL;     p...

Delete Alternate Nodes in LL

Implementation in C: #include<stdio.h> #include<stdlib.h> struct node { int data; struct node* next; }; void push(struct node** ref, int newData) {     struct node* newNode = (struct node*)malloc(sizeof(struct node));     newNode->data = newData;     newNode->next = (*ref);     (*ref) = newNode; } void print(struct node* n) {     struct node* temp = n;     if(temp == NULL)     {     printf("Empty LinkedList");     }     while(temp!=NULL)     {     printf(" %d",temp->data);     temp=temp->next;     } } void alternateDelete(struct node* head) {     struct node* prev= head;     struct node* node=head->next ;     if(head == NULL)         return;     while(prev != NULL && node != NULL)     {     prev->...

Move Last Element to first of LL

Implementation in C: #include<stdio.h> #include<stdlib.h> struct node { int data; struct node* next; }; void push(struct node** ref, int newData) {     struct node* newNode = (struct node*)malloc(sizeof(struct node));     newNode->data = newData;     newNode->next = (*ref);     (*ref) = newNode; } void print(struct node* n) {     struct node* temp = n;     if(temp == NULL)     {     printf("Empty LinkedList");     }     while(temp!=NULL)     {     printf(" %d",temp->data);     temp=temp->next;     } } void relocate(struct node** head) {     struct node* current= *head;     struct node* temp= NULL;     if(*head == NULL || (*head)->next == NULL)         return;     while(current->next != NULL)     {     tem...

Pairwise Swap elements of LL

Implementation in C: #include<stdio.h> #include<stdlib.h> struct node { int data; struct node* next; }; void push(struct node** ref, int newData) {     struct node* newNode = (struct node*)malloc(sizeof(struct node));     newNode->data = newData;     newNode->next = (*ref);     (*ref) = newNode; } void print(struct node* n) {     struct node* temp = n;     if(temp == NULL)     {     printf("Empty LinkedList");     }     while(temp!=NULL)     {     printf(" %d",temp->data);     temp=temp->next;     } } void pairswap(struct node* head) {     struct node* current = head;     while(current!=NULL && current->next != NULL)     {     swap(&current->data,&current->next->data);     current = current->next->next; ...