Arista Networks Interview Questions
- 0of 0 votes
AnswersFor above question, asked to do coding in C Lang.
- mikela6 August 25, 2021 in India for forwarding team
He asked me what data structure to be used for storing employee records.
Then about the uses of arrays, hashmaps.
Which has more advantages if we want to search for a record with employee name?| Report Duplicate | Flag | PURGE
Arista Networks SDE-2 - 0of 0 votes
AnswersAssume there are employee records with all required fields. like name, emp_id, manager_name etc..
- mikela6 August 25, 2021 in India for forwarding team
Write a SQL query to print the 2 employee names whose manager is same.| Report Duplicate | Flag | PURGE
Arista Networks SDE-2 - 0of 0 votes
AnswersWhat is process synchronization, why do we need volatile keyword if we need to use mutex locks
- mikela6 August 25, 2021 in India for forwarding team| Report Duplicate | Flag | PURGE
Arista Networks SDE-2 - 0of 0 votes
AnswersVolatile keywork --> what is the use of it, why compiler has to do optimizations, in which cases u have used volatile.
- mikela6 August 25, 2021 in India for forwarding team| Report Duplicate | Flag | PURGE
Arista Networks SDE-2 - 0of 0 votes
Answers#include <stdio.h>
- ds March 22, 2021 in India
#include <stdlib.h>
#include <assert.h>
void my_free(char *p) {
free(p);
p = NULL;
}
int main() {
char *p = (char*) malloc(100);
my_free(p);
assert(p == NULL);
}
Will this code work? or crash| Report Duplicate | Flag | PURGE
Arista Networks Software Developer - 0of 0 votes
Answersinsert node to Binary search tree(BST) both recursively and iteratively.
- ds March 22, 2021 in India| Report Duplicate | Flag | PURGE
Arista Networks Software Developer - 0of 0 votes
Answersarista-networks-interview-questions
- John4jobs March 17, 2017 in United States
0
of 0 votes
0
Answers
Write findMin, findNext of BST tree node has parent and write PrintBST using above two
arista-networks-interview-questions
0
of 0 votes
0
Answers
Write findMin, findNext of BST tree node has parent pointer also.
void printBST(TreeNodep root) {
TreeNodep temp , next;
temp = findMin(root);
while (1) {
printf("%d",temp->value);
next = findNext(temp);
if (!next)
return;
printf("%d",next->value);
temp = next;
}
}| Report Duplicate | Flag | PURGE
Arista Networks Developer Program Engineer - 0of 0 votes
AnswerWrite findMin, findNext of BST tree node has parent pointer also. http://www.geeksforgeeks.org/find-the-minimum-element-in-a-binary-search-tree/
- John4jobs March 17, 2017 in United States
http://www.geeksforgeeks.org/inorder-successor-in-binary-search-tree/| Report Duplicate | Flag | PURGE
Arista Networks Developer Program Engineer Data Structures - 0of 0 votes
AnswersFrom here : question?id=5660692209205248
- NoOne October 19, 2016 in United States
In-order traversal:
A->B->C->D->E->F->H->L->M-P->R->S->T
Write a function (pseudo-code is fine) that given a starting node, advances to the next in-order node in a binary tree.
Please also provide a data-structure definition of a node.| Report Duplicate | Flag | PURGE
Arista Networks Software Developer Algorithm Trees and Graphs - 0of 2 votes
Answers#include <stdio.h>
- aristainterview October 19, 2016 in United States
int main( int argc, char* argv[] ){
char* string1 = "string";
char string2[] = "string";
}
#include <stdio.h>
/* Describe the code below */
struct s {
double f;
int i;
char c[3];
void *p;
int x[0];
};
int main( int argc, char ** argv ) {
struct s temp;
printf("The size of the struct is %d \n", sizeof(temp));
printf("The size of the double is %d \n", sizeof(temp.f));
printf("The size of a character array is %d \n", sizeof(temp.c));
printf("The size of a void pointer is %d \n", sizeof(temp.p));
printf("The size of a integer array is %d \n", sizeof(temp.x));
printf("The size of a integer is %d \n", sizeof(temp.i));
return 0;
}
/* What's wrong with this program? */
#include <stdio.h>
int
main( int argc, char const * argv ) {
for( int i = 0; i < argc; ++i ) {
printf("%s\n", argv[i] );
}
}
/* Can you tell me what the program will do when I run it like this:
* <prog> 1 2 3 4
*/
/*
Describe what two of these do, and how they're useful for debugging:
perf
oprofile
gprof
strace
gcov
printf
syslog
*/
#include <stdlib.h>
#include <stdio.h>
class C {
public:
void func() {
printf("func called\n");
}
virtual void virtualFunc() {
printf("virtual func called\n");
}
};
int main (int argc, char ** argv) {
C * obj = NULL;
/* What does the following print? */
obj->func();
/* What does the following print? */
obj->virtualFunc();
/* What's the difference? */
}
/* What's polymorphism? */
/* What's abstraction? */
#include <cstdlib>
#include <ctime>
#include <sys/time.h>
#include <iostream>
#include <cstdio>
using namespace std;
/* What do this do? */
int a( unsigned int i ) {
int c = 0;
while( i ) {
if( i & 1 ) { c++; }
i >>= 1;
}
return c;
}
/* What does this one do? */
int b( unsigned int i ) {
static unsigned char n[] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
int c = 0;
while( i ) {
c+=n[i&15];
i >>= 4;
}
return c;
}
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
std::string::iterator contains(char c, string s1) {
std::string::iterator i = std::find(s1.begin(), s1.end(), c);
if (i != s1.end())
return i;
else
return null;
}
int anagram ( const string s1, const string s2) {
for( int i = 0; i < s1.size(); i++) {
std::string::iterator i = ,s2.find(s1[i]);
if (i != s2.end())
s2.erase(i);
else
return false;
}
return s2.size()==0;
}
int main (int argc, char *argv[] ){
printf("%d",anagram(argv[1],argv[2]));
}
F
/ \
/ \
D M
/ \ / \
B E L P
/ \ / \
A C H S
/ \
R T
In-order traversal:
A->B->C->D->E->F->H->L->M-P->R->S->T
Requirement:
Write a function (pseudo-code is fine) that given a starting node, advances to the next in-order node in a binary tree.
Please also provide a data-structure definition of a node.
struct node
{
};
node *next_node(node *current)
{
node *next;
/* current - any node in the tree, advance to next node */
return next;
}
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
/*
vercmp compares two software version strings and returns the following:
if v1 > v2 : return 1
if v1 == v2 : return 0
if v1 < v2 : return -1
input strings are in the form "1.0.3", "2.10", "6.0.0.3", etc...
"1.0" is considered bigger than "1" and "1.10" is greater than "1.2"
*/
int vercmp( char * v1, char * v2 ) {
}
int main() {
assert( vercmp( "1.1", "1.0" ) == 1 );
assert( vercmp( "1.0", "1.1" ) == -1 );
assert( vercmp( "1.0", "1.0" ) == 0 );
assert( vercmp( "1", "1.0" ) == -1 );
assert( vercmp( "1.0", "1" ) == 1 );
return 0;
}
Describe in 5 minutes or less what one of these protocols is:
BGP
OSPF
ISIS
PIM-SM
IGMP
STP
DHCP
Could you configure a network device (EOS, Cisco, Linux, JunOS, Quagga, etc.) to
enable any of these?
Pick one of these data structures and tell me everything you know about it:
Red-black tree
B-tree
Patricia
Avl Tree
Trie
Or describe a data structure that can store a set of integers.
If you're not familiar with any of the above, tell me what you know about
one of these:
Bit vector
Binary tree
std::vector
Doubly Linked List
#!/usr/bin/python
# Write a program to num up the Nth column of integers in a file that has
# M columns in it.
What do these tools do?
tcpdump
ping
wireshark
traceroute
ifconfig
ip
netstat
What seven system calls do you use to implement a TCP server?
#include <stdio.h>
#include <stdlib.h>
#include "list.h"
/**
* Given a linked list of the structure:
struct node {
int val;
struct node* next;
};
print out the fibonacci nodes e.g. the 1st, 2nd, 3rd, 5th, 8th... nodes
up until the list ends.
*/
int main( int argc, char** argv ) {
if( argc != 2 ) {
printf( "usage fib num --you gave %d args\n", argc - 1 );
exit( 0 );
}
int nodes = atoi( argv[ 1 ] );
if( nodes < 1 ) {
printf( "num must be a positive number --you gave %d\n", nodes );
}
struct node* list = createList( nodes );
// ...
freeList( list, nodes );
}
include <stdlib.h>
#include <assert.h>
struct node {
int val;
struct node* next;
};
struct node* createList( int nodes );
struct node* freeList( struct node* list, int nodes );
struct node* createList( int nodes ) {
int i = 0;
struct node* list =
( struct node* ) malloc( sizeof( struct node ) * nodes );
assert( list );
for( i = nodes - 1; i >= 0; --i ) {
list[ i ].val = ( nodes - i ) - 1;
list[ i ].next = list + ( i - 1 );
}
list[ 0 ].next = NULL;
return &list[ nodes - 1 ];
}
struct node* freeList( struct node* list, int nodes ) {
free( &list[ 1 - nodes ] );
}
#include <stdio.h>
#include <assert.h>
#include <stdbool.h>
extern bool isPalindrome( const char * );
int main() {
assert( isPalindrome( "civic" ) == true );
assert( isPalindrome( "evitative" ) == true );
assert( isPalindrome( "radar" ) == true );
assert( isPalindrome( "stats" ) == true );
assert( isPalindrome( "abba" ) == true );
assert( isPalindrome( "aba" ) == true );
assert( isPalindrome( "aBa" ) == true );
assert( isPalindrome( "statss" ) == false );
assert( isPalindrome( "abracadabra" ) == false );
printf( "Lower case palindromes passed!\n" );
assert( isPalindrome( "ABa" ) == true );
assert( isPalindrome( "cIviC" ) == true );
printf( "Upper/lower cases examples passed!\n" );
assert( isPalindrome( "" ) == false );
assert( isPalindrome( NULL ) == false );
printf( "No string/empty string corner cases passed!\n" );
printf( "Nailed it!! Congratulations!\n" );
return ( 0 );
}
#include "caesar.h"
#include <stdlib.h>
char rotate(const char in, char pivot, int offset)
{
return pivot + (in - pivot + offset) % 26;
}
void caesar(const char *in, char *outbuf, int offset)
{
int i;
char *out = outbuf;
for (; *in; ++in, ++out) {
if (*in >= 'A' && *in <= 'Z')
*out = rotate(*in, 'A', offset);
else if (*in >= 'a' && *in <= 'z')
*out = rotate(*in, 'a', offset);
else
*out = *in;
}
*out = 0;
}
#include "caesar.h"
#include <stdlib.h>
#include <stdio.h>
int
main(int argc, char *argv[])
{
char *buf = strdup(argv[1]);
caesar(buf, buf, 13);
printf("%s\n", buf);
free(buf);
return 0;
}
struct Tree {
struct Tree * left; // for bst, check all nodes are less than parent
struct Tree * right; // for bst, check all nodes are greater than parent
int value;
}
bool isBst( Tree * tr ) {
return (tr, INT_MIN, INT_MAX);
}
bool helpIsBst(Tree * root, int min, int max) {
if (root == NULL) return 1;
return ( root->value < max && root->value > min
&& helpIsBst(root->left, min, root->value)
&& helpIsBst(root->right, root->value, max));
}
Example BST:
*
* 8
* / \
* 4 12
* / \ / \
* 1 7 11 20
*/
struct node {
int value;
struct node *left, *right, *parent;
}
/* print the bst in-order */
void printBst( struct node *n ) {
}
struct node * findMin( struct node *n ){
}
struct node * findNext( struct node *n ) {
}
void foo( struct node *root) {
for( struct node * n = findMin(root); n; n = findNext(n) ) {
printf( "%d ", n->value );
}
}
#include <cstdio>
// 10
// / \
// 5 16
// / \ / \
// 3 11 14 17
struct node {
int value;
node * left;
node * right;
node * parent;
node( int value, node * left, node * right, node * parent=NULL ) : value( value ), left( left ), right( right ), parent( parent ) {}
};
// Test functions
void connect_parents( node * n, node * parent ) {
if( n ) {
n->parent = parent;
connect_parents( n->left, n );
connect_parents( n->right, n );
}
}
node * construct_tree() {
node * root = new node(
10,
new node( 5,
new node( 3, NULL, NULL ),
new node( 9, NULL, NULL ) ),
new node( 16,
new node( 14, NULL, NULL ),
new node( 17, NULL, NULL ) ) );
connect_parents( root, NULL );
return root;
}
int main() {
node * root = construct_tree();
// for( node * n = find_min( root ); n; n = find_next( n ) ) {
// printf( "%d\n", n->value );
return 0;
}
1. Create account for interviewee
$ tempaccount <username>
2. Login to recruit.arista.com as interviewee
$ ssh username@recruit.arista.com # passwd=aristarecruit
3. Install interview questions into temp account
$ cp ~bterrell/screeningQuestions.gz .
$ tar xvfz screeningQuestions.gz
$ rm screeningQuestions.gz
4. Start tmux on my shell with two panes
$ cp ~bterrell/.tmux.conf ~/.
$ tmux new -s interview
- ctrl+\, "-" to split panes
5. Meet with interviewee (or telecon)
$ ssh username@recruit.arista.com # passwd=aristarecruit
$ tmux attach -t interview"
- switch panes with ctrl+\, <up-or-down arrow>
#include <stdio.h>
#include <stdlib.h>
/* Example BST:
*
* 8
* / \
* 4 12
* / \ / \
* 1 7 11 20
*/
typedef struct node {
int value;
struct node *left, *right, *parent;
} node_t;
struct node * findMin( struct node *n ) {
for(; n && n->left; n = n->left) ;
return n;
}
struct node * findNext( struct node *n ) {
if(n->right) {
return findMin(n->right);
}
else {
for(; n->parent; n=n->parent) {
if(n->parent->left == n) {
return n->parent;
}
}
return NULL;
}
}
/* print the bst in-order */
void printBst( struct node *n ) {
if(n->left) {
printBst(n->left);
}
printf("%d ", n->value);
if(n->right) {
printBst(n->right);
}
void printBstNR( struct node *root) {
node_t* n;
for( n = findMin(root); n; n = findNext(n) ) {
printf( "%d ", n->value );
}
}
node_t* insertNode(node_t** root, int newval)
{
node_t *n;
if(!(*root)) {
n = (node_t*)calloc(1, sizeof(node_t));
n->value = newval;
*root = n;
}
else if(newval < (*root)->value) {
n = insertNode(&((*root)->left), newval);
if((*root)->left == n) n->parent = *root;
}
else {
n = insertNode(&((*root)->right), newval);
if((*root)->right == n) n->parent = *root;
}
return n;
}
int main()
{
node_t* root = NULL;
int data[] = { 8, 4, 12, 1, 7, 11, 20 };
int i, len = sizeof(data) / sizeof(int);
for(i=0; i < len; i++) insertNode(&root, data[i]);
printf("\ntraversal w/o recursion: ");
printBstNR(root);
printf("\ntraversal w/o recursion: ");
printBstNR(root);
printf("\ntraversal w/ recursion: ");
printBst(root);
printf("\n");
return 0;
}
#include <algorithm>
#include <stdio.h>
#include <string.h>
#include <string>
using namespace std;
int anagram ( const string s1, const string s2) {
for( int i = 0; i < s1.size(); i++) {
int x = s2.find(s1[i]);
if (x != string::npos)
s2.erase(x);
else
return false;
}
return s2.size()==0;
}
int main (int argc, char *argv[] ){
printf("%d",anagram(argv[1],argv[2]));
}| Report Duplicate | Flag | PURGE
Arista Networks Software Developer - -1of 1 vote
Answers#include <stdlib.h>
- aristainterview October 19, 2016 in United States
#include <assert.h>
extern int find( int *, int );
int main( int argc, char *argv[] ) {
int o[4][5] = { { 4,6,7,8,9 },
{ 4,5,7,8,9 },
{ 4,5,6,8,9 },
{ 4,5,6,7,9 } };
int e[5][6] = { { 4,6,7,8,9,10 },
{ 4,5,7,8,9,10 },
{ 4,5,6,8,9,10 },
{ 4,5,6,7,9,10 },
{ 4,5,6,7,8,10 } };
int i;
for( i=0; i < 4; i++ )
assert( find( o[ i ], 5 ) == i + 5 );
for( i=0; i < 5; i++ )
assert( find( e[ i ], 6 ) == i + 5 );
printf ("I'm a winner\n");
return 0;
}
#include <stdlib.h>
//
// find( ... )
//
// find takes and array of sorted consecutive positive ints where
// one number is missing and returns the missing number
// find should return 0 on all error conditions
//
// [ 1, 2, 3, 4, 6, 7, 8, 9 ] -> return 5
// [ 11, 12, 13, 15, 16, 17 ] -> return 14
//
/* What's wrong with this program? */
#include <stdio.h>
int
main( int argc, char const * argv ) {
for( int i = 0; i < argc; ++i ) {
printf("%s\n", argv[i] );
}
}
/* Can you tell me what the program will do when I run it like this:
* <prog> 1 2 3 4
*/
/*
Describe what two of these do, and how they're useful for debugging:
perf
oprofile
gprof
strace
gcov
printf
syslog
*/
int main( int argc, char* argv[] ){
char* string1 = "string";
char string2[] = "string";
}
#include <stdio.h>
class C {
public:
void func() {
printf("func called\n");
}
virtual void virtualFunc() {
printf("virtual func called\n");
}
};
int main (int argc, char ** argv) {
C * obj = NULL;
/* What does the following print? */
obj->func();
/* What does the following print? */
obj->virtualFunc();
/* What's the difference? */
}
/* What's polymorphism? */
* What's abstraction? */‘
/* What's a virtual function table? */
/* What's a smart pointer? */
/* What's a copy constructor? */
* Tell me what this expression does: */
/* cout << 3; */
/* What could it do? */
/* Have you ever seen OOP inside a Unix kernel? */
/* What's C++0X? */
/* What is const? */
/* What is name mangling? */
/* What does "extern C" do? */
/* What's std::map? */
write( 1, c, strlen(c) );
/* What does this do? */
printf( "%s", c );
/* What's the difference? */
/* What does malloc do? */
/* What does the '-9' mean in 'kill -9'? */
/* What would kill -11 do? */
/* What's a zombie process? */
/* What does fork return? */
/* What is the return value of main used for? */
* What is select used for? Have you ever heard of epoll? */
struct s {
double f;
int i;
char c[3];
void *p;
int x[0]; }; int main( int argc, char ** argv ) { }
/* How big is a float? */
/* write a program to tell me how big a float is */
/* can you use gdb to show me how big a float is? */
/* How many bytes will structure s take? */
/* Write a quick program to tell me the size of structure s */
/* Does this match what you expected? */
/* What does this do?
#define ABC(x) aaa ## x
ABC(b)
*/
/* How are 1d arrays laid out in C ? */
/* What does the compiler do when you have a statement a[ 5 ] */
/* How do you create dynamically allocated arrays in C and how does the complier generate the memory access for a[ 5 ] */
/* How are 2d arrays laid out in C */
/* How do you create a dynamically allocated 2d array in C such that something like:
int **a = get2dArray( 5, 6)
a[ 2 ][ 3] = 5;
would work properly.*/
/* How would you extend it to create an N dimensional array. Something like:
getNdArray( int n, int * dim)
where n = the number of dimensions, and dim is the actual dimensions.
so you could create a 3d array of size 3,4,5 as
int dim[] = [ 3, 4, 5 ];
int ***a = getNdArray( 3, dim );struct s {
double f;
int i;
char c[3];
void *p;
int x[0];
};
int main( int argc, char ** argv ) {
struct s s1;
printf("%i\n", sizeof(s1.f));
printf("%i\n", sizeof(s1.i));
printf("%i\n", sizeof(s1.c));
printf("%i\n", sizeof(s1.p));
printf("%i\n", sizeof(s1.x));
printf("%i\n", sizeof(s1));
}*/
#include <ctime>
#include <sys/time.h>
#include <iostream>
#include <cstdio>
using namespace std;
/* What do this do? */
int a( unsigned int i ) {
int c = 0;
while( i ) {
if( i & 1 ) { c++; }
i >>= 1;
}
return c;
}
/* What does this one do? */
int b( unsigned int i ) {
static unsigned char n[] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
int c = 0;
while( i ) {
c+=n[i&15];
i >>= 4;
}
return c;
}
/* Which one do you think would run faster? */
/* Write a small program that uses the gettimeofday function to
* benchmark these functions.
*
* int gettimeofday(struct timeval *tv, struct timezone *tz);
*
* struct timeval {
* time_t tv_sec; // seconds
* suseconds_t tv_usec; // microseconds
* };
*
* The tz argument can be NULL in this case.
*/
int main( int argc, char **argv ) {
}
#include <ctime>
#include <sys/time.h>
#include <iostream>
#include <cstdio>
using namespace std;
/* What do this do? */
int a( unsigned int i ) {
int c = 0;
while( i ) {
if( i & 1 ) { c++; }
i >>= 1;
}
return c;
}
/* What does this one do? */
int b( unsigned int i ) {
static unsigned char n[] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
int c = 0;
while( i ) {
c+=n[i&15];
i >>= 4;
}
return c;
}
/* Which one do you think would run faster? */
/* Write a small program that uses the gettimeofday function to
* benchmark these functions.
*
* int gettimeofday(struct timeval *tv, struct timezone *tz);
*
* struct timeval {
* time_t tv_sec; // seconds
* suseconds_t tv_usec; // microseconds
* };
*
* The tz argument can be NULL in this case.
*/
int main( int argc, char **argv ) {
struct timeval t1 = {0, 0};
struct timeval t2 = {0, 0};
PROJECT = find
CC = gcc
OBJ = find.o main.o
all: $(PROJECT)
.c.o:
$(CC) -I. -g -c $<
$(PROJECT): $(OBJ)
$(CC) $(OBJ) -o $(PROJECT)
clean:
rm -f find find.o main.o
/*
* describe the code below
*/
struct s {
double f;
int i;
char c[3];
void *p;
int x[0];
};
int main( int argc, char ** argv ) {
struct s new_s;
size_t size = sizeof(new_s.f);
size_t size_i = sizeof(new_s.i);
size_t size_c = sizeof(new_s.c);
size_t size_p = sizeof(new_s.p);
size_t size_x = sizeof(new_s.x);
int size_s = (int) sizeof(new_s);
int total = (int) size + size_i + size_c + size_p + size_x;
printf ("Total: %d", total);
printf ("Struct size: %d", size_s);
return 0;
}
/* How are 1d arrays laid out in C ? */
/* What does the compiler do when you have a statement a[ 5 ] */
/* How do you create dynamically allocated arrays in C and how does the complier generate the memory access for a[ 5 ] */
/* How are 2d arrays laid out in C */
/* How do you create a dynamically allocated 2d array in C such that something like:
int **a = get2dArray( 5, 6)
a[ 2 ][ 3] = 5;
would work properly.*/
/* How would you extend it to create an N dimensional array. Something like:
getNdArray( int n, int * dim)
where n = the number of dimensions, and dim is the actual dimensions.
so you could create a 3d array of size 3,4,5 as
int dim[] = [ 3, 4, 5 ];
int ***a = getNdArray( 3, dim );
*/| Report Duplicate | Flag | PURGE
Arista Networks Software Developer - -1of 1 vote
Answers#ifndef STACK_H
- aristainterview October 19, 2016 in United States
#define STACK_H
typedef struct my_stack_ {
unsigned char *buf;
size_t elem_count;
size_t elem_size;
size_t buf_size;
} my_stack_t;
typedef struct my_stack_ my_stack_t;
my_stack_t * my_stack_init(size_t elem_size);
void my_stack_push(my_stack_t *stack, void *elem);
int my_stack_pop(my_stack_t *stack, void *elem);
size_t my_stack_depth(my_stack_t *stack);
void my_stack_push(my_stack_t *stack, void *elem)
{
assert(stack && elem);
size_t offset = stack->elem_count * stack->elem_size;
if(offset >= stack->buf_size) {
size_t new_size = stack->buf_size * 2;
unsigned char *p = realloc(stack->buf, new_size);
stack->buf = p;
}
stack->elem_count++;
memcpy(stack->buf + offset, elem, stack->elem_size);
}
#endif
struct node {
int value;
struct node * next;
};
struct node * mylist;
mylist
[--]--
|
|
---->[ 3, --]---->[ 2, --]---->[ 1, X]
remove_matches( mylist, 2 );
mylist
[—]—:
|
| -----------------------
| | |
| | v
---->[ 3, | ] [ 2, --]---->[ 1, X]
mylist
[--]--
|
|
---->[ 3, --]---->[ 1, X]| Report Duplicate | Flag | PURGE
Arista Networks Software Developer - 0of 0 votes
AnswersMerge two sorted singly linked lists into one sorted singly linked list. Allocate no extra node.
- Saurabh Singhal January 16, 2016 in India| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer Data Structures Linked Lists - -1of 1 vote
AnswersSuppose a nxn chessboard has two diagonally opposite corners removed, leaving n^2-2 squares. Is it possible to place (n^2-2)/2 dominoes of size 2x1 so as to cover all of these squares?
- Saurabh Singhal January 16, 2016 in India| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer - 0of 0 votes
AnswerProgram to check whether 2 rectangles in a 2 D plane overlap or not.
- Saurabh Singhal January 16, 2016 in India| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer General Questions and Comments - 0of 0 votes
AnswerGiven a sorted integer array. Convert it to a balanced BST (Size of array is given)
- Saurabh Singhal January 16, 2016 in India| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer Data Structures Trees and Graphs - 0of 0 votes
AnswersAllocate a 2-D array of size m*n using malloc(). The array should be accessible as a[i][j].
- Saurabh Singhal January 16, 2016 in India| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer Arrays C Data Structures Matrix - 0of 0 votes
AnswersProvide an implementation of the stack functionality [i.e. LIFO] in a library. Since its going to be a library function, it can accept objects of any type.
- bandicoot8723 May 21, 2012 in United States
- Write the APIs
- Discuss how you would structure the API's to handle objects of any type
- What data structure would you use
- Since its a library API that you are providing, keep in mind that you will be dealing with multiple stacks and that an object can be present in more than one stack| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer / Developer Algorithm - 0of 0 votes
AnswersHow many spaces does the following struct take on a 32-bit computer?
- Lily March 20, 2012 in United States
struct s{
char c;
int i;
double d;
void *p;
int a[0];
}| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer / Developer - 0of 0 votes
AnswersGiven a linked list of integers, delete all the nodes from the linked list which data value equals to a given value.
- Lily March 20, 2012 in United States
void delete(Node **l, int target);| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer / Developer Algorithm C Linked Lists - 0of 0 votes
AnswersUsually first round consists of phone interviews.Try to finish your programming problems asap as the interviewer expects you to solve atleast 3-4
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform multiplication of two bytes without * operator!!!
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
Use shift operations| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform right rotate operation in C
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
unsigned char rotate(unsigned char c,int m)
Basically rotate m time the bits of char c| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform right rotate operation in C
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
unsigned char rotate(unsigned char c,int m)
Basically rotate m time the bits of char c| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersUsually first round consists of phone interviews.Try to finish your programming problems asap as the interviewer expects you to solve atleast 3-4
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform multiplication of two bytes without * operator!!!
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
Use shift operations| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform right rotate operation in C
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
unsigned char rotate(unsigned char c,int m)
Basically rotate m time the bits of char c| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform multiplication of two bytes without * operator!!!
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
Use shift operations| Report Duplicate | Flag | PURGE
Arista Networks C - 0of 0 votes
AnswersPerform multiplication of two bytes without * operator!!!
- rohit.athavale89 February 28, 2012 in United States for platform engineering intern
Use shift operations| Report Duplicate | Flag | PURGE
Arista Networks C