Arista Networks
4.1 of 5 61 reviews
www.aristanetworks.com Santa Clara, CA 500 to 999 Employees

Arista Networks Software Engineer Interview Question

I interviewed in Bangalore (India) and was asked:
"Write a procedure to delete all occurrences of a node in a singly linked list."
Add Tags [?]
Answer Flag Question

Part of a Software Engineer Interview Review - one of 71 Arista Networks Interview Reviews

Answers & Comments

0
of 0
votes
#include<stdio.h>
struct node
{
    int data;
    struct node * next;
};

void deleteANodeInList (struct node ** Linkedlist, int val)
{
    struct node * list = *Linkedlist;
    struct node * head = *Linkedlist;
    if(list == NULL);
        return;
    while(!list)
    {
        if(list->data == val)
        {
            struct node * tmp = list;
            if(list == head)
            {
                *Linkedlist = list->next;
                head = list->next;
            }
            list = list->next;
            free(tmp);
        }
        else
        {
            list = list->next;
        }
    }
}
- Anonymous on May 31, 2013 Flag Response

To comment on this question, Sign In with Facebook or Sign Up


Tags are like keywords that help categorize interview questions that have something in common.

Glassdoor is your free inside look at Arista Networks interview questions and advice. All interview reviews posted anonymously by Arista Networks employees and interview candidates.