Answered Questions

  • Stack using two queues

    write a code how to implement stack using two queues? and vice versa ?

    ptmich

    • May 28th, 2012

    "c 1.queue_t q0; 2.queue_t q1; 3. 4.void stack_push(void *t) { 5. // At any given time one queue will be empty 6. queue_t *curr = (q0.isEmpty() ? q1 : q0); 7. 8. curr.push(t);...

  • write a program to insert a node at a given position in a single linked list?

    rjshkr

    • Sep 28th, 2012

    "c NODE insert(NODE head,int data,int pos) { NODE temp,new,prev = NULL; int i=1; new = (NODE)malloc(sizeof(struct node)); new->info = data; if(head == NULL) { new->link = ...

    Rahul goyal

    • Jul 20th, 2012

    Code
    1. //let the structure name be stud
    2. void insert_pos(stud *head, pos)
    3. {
    4.   stud s,*t;
    5.  s.input(); //accept the data
    6.  t=head;
    7. pos--;
    8. while(t!=NULL && pos)
    9. {
    10.   t=t->next;
    11.    pos--;
    12. }
    13. s->next=t->next;
    14. t->next=s;
    15. }
    16.  

  • Reverse Single Linked List

    How will you reverse a single linked list which consists of nodes a to z using recursion?

    sasibhushan.m

    • Jul 31st, 2011

    Node* reverse_recursive(node *root)
    {
    if(root->link != NULL)
    {
    reverse_recursive(root->link);
    root->link->link = root;
    return (root);
    }
    else
    {
    head = root;
    }
    }

    ilushka

    • Jul 29th, 2011

    Lets see...

    Code
    1. node *reverse(node *list) {
    2.   node *reversed_last = NULL;
    3.  
    4.   if (list->next != NULL) {
    5.     reversed_last = reverse(list->next);
    6.   } else {
    7.     return list;
    8.   }
    9.  
    10.   reversed_last->next = list;
    11.   list->next = NULL;
    12.  
    13.   return list;
    14. }

  • what is the difference between unix and linux?

    ilushka

    • Nov 4th, 2011

    Linux does not have to have a GUI. Unix is an OS built in the 60s and 70s at the Bell Labs and later it gave rise to many Unix-like, or *nix, operating systems. One example is Linux, kernel of which h...

    AVINASH BANSAL

    • Oct 29th, 2011

    Unix i s created by AT&T BELL LABS AND MIT invited year in 1960's
    linux is created by LINUS TORVALDS invited year in 1991
    unix is not support processor Intel 386
    linux is support processor Intel 386

  • what is the size of a void pointer ?

    Niyas Ibrahim

    • Sep 2nd, 2013

    Use of pointer is to store a memory address.since any location in the memory have same type(characters or digits) of memory address, size is same for all pointer types.

    jignesh

    • Dec 29th, 2012

    Size of void pointer or size of character pointer are same because both variable contain address or we can say memory location