## Tableau Interview Question for Software Engineer / Developers

Country: United States
Interview Type: In-Person

Comment hidden because of low score. Click to expand.
2
of 2 vote

``````public Node successor(Node root, int value) {
Node curr = root;
Node result = null;
while (curr != null) {
if (curr.value <= value) {
curr = curr.right;
} else {
result = curr;
curr = curr.left;
}
}
return result;
}``````

Comment hidden because of low score. Click to expand.
1
of 1 vote

this is nothing but finding the inorder successor of a value in BST

Comment hidden because of low score. Click to expand.
0
of 0 vote

Pre-order, in-order, post-order traversal?

Comment hidden because of low score. Click to expand.
0
of 0 vote

This is nothing but finding the inorder successor of a value in BST

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````c code
-------------------

#include<stdio.h>
#include<alloc.h>
struct BST
{
int data;
struct BST*Lc,*Rc;
void InsertData(int);
void Dispay(struct BST*);
void DispayNextElement(int);
main()
{
int value;
char insert='y';
while(insert=='y'||insert=='Y')
{
printf("\n Enter one (int) data:-");
scanf("%d",&value);
InsertData(value);
fflush(stdin);
printf("\n Eneter another element(y/n):=");
scanf("%c",&insert);
}
insert='y';
while(insert=='y'||insert=='Y')
{
printf("\n Enter find next data:-");
scanf("%d",&value);
DispayNextElement(value);
fflush(stdin);
printf("\n Find another element(y/n):=");
scanf("%c",&insert);
}
}
void DispayNextElement(int value)
{
int i=0;
printf("no Element in this tree");
else
{
while(temp!=NULL)
{
if(temp->data>value)
{
temp=temp->Lc;
}
else if(temp->data<value)
{
temp=temp->Rc;
}
else if(temp->data==value)
{
break;
}
else
{
printf("\n Element Not Persent");
return;
}
}
if(temp!=NULL&&temp->data==value)
{
if(temp->Lc!=NULL)
printf("\nnext data:- %d",temp->Lc->data);
else if(temp->Rc!=NULL)
printf("\n next daat:- %d",temp->Rc->data);
else
printf("\n No next element");
}
else
{
printf("\n element not present ");
}
}
}
void Dispay(struct BST* temp)
{
if(temp==NULL)
return;
else
{
Dispay(temp->Lc);
printf("%5d",temp->data);
Dispay(temp->Rc);
}
}

void InsertData(int value)
{
element->Lc=NULL;
element->Rc=NULL;
element->data=value;
else
{
while(temp!=NULL)
{
if(temp->data>=value)
{
if(temp->Lc!=NULL)
temp=temp->Lc;
else
{
temp->Lc=element;
break;
}
}
else
{
if(temp->Rc!=NULL)
temp=temp->Rc;
else
{
temp->Rc=element;
break;
}
}
}
}
}

---------------------------
OutPut...

Enter one (int) data:-20

Eneter another element(y/n):=y

Enter one (int) data:-17

Eneter another element(y/n):=y

Enter one (int) data:-23

Eneter another element(y/n):=y

Enter one (int) data:-6

Eneter another element(y/n):=y

Enter one (int) data:-18

Eneter another element(y/n):=y

Enter one (int) data:-25

Eneter another element(y/n):=y

Enter one (int) data:-5

Eneter another element(y/n):=y

Enter one (int) data:-8

Eneter another element(y/n):=y

Enter one (int) data:-24

Eneter another element(y/n):=y

Enter one (int) data:-29

Eneter another element(y/n):=y

Enter one (int) data:-10

Eneter another element(y/n):=y

Enter one (int) data:-9

Eneter another element(y/n):=n
5    6    8    9   10   17   18   20   23   24   25   29
Enter find next data:-78

element not present
Find another element(y/n):=y

Enter find next data:-17

next data:- 6
Find another element(y/n):=y

Enter find next data:-24

No next element
Find another element(y/n):=y

Enter find next data:-25

next data:- 24
Find another element(y/n):=n

--------------------------------``````

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````c code
-------------------

#include<stdio.h>
#include<alloc.h>
struct BST
{
int data;
struct BST*Lc,*Rc;
void InsertData(int);
void Dispay(struct BST*);
void DispayNextElement(int);
main()
{
int value;
char insert='y';
while(insert=='y'||insert=='Y')
{
printf("\n Enter one (int) data:-");
scanf("%d",&value);
InsertData(value);
fflush(stdin);
printf("\n Eneter another element(y/n):=");
scanf("%c",&insert);
}
insert='y';
while(insert=='y'||insert=='Y')
{
printf("\n Enter find next data:-");
scanf("%d",&value);
DispayNextElement(value);
fflush(stdin);
printf("\n Find another element(y/n):=");
scanf("%c",&insert);
}
}
void DispayNextElement(int value)
{
int i=0;
printf("no Element in this tree");
else
{
while(temp!=NULL)
{
if(temp->data>value)
{
temp=temp->Lc;
}
else if(temp->data<value)
{
temp=temp->Rc;
}
else if(temp->data==value)
{
break;
}
else
{
printf("\n Element Not Persent");
return;
}
}
if(temp!=NULL&&temp->data==value)
{
if(temp->Lc!=NULL)
printf("\nnext data:- %d",temp->Lc->data);
else if(temp->Rc!=NULL)
printf("\n next daat:- %d",temp->Rc->data);
else
printf("\n No next element");
}
else
{
printf("\n element not present ");
}
}
}
void Dispay(struct BST* temp)
{
if(temp==NULL)
return;
else
{
Dispay(temp->Lc);
printf("%5d",temp->data);
Dispay(temp->Rc);
}
}

void InsertData(int value)
{
element->Lc=NULL;
element->Rc=NULL;
element->data=value;
else
{
while(temp!=NULL)
{
if(temp->data>=value)
{
if(temp->Lc!=NULL)
temp=temp->Lc;
else
{
temp->Lc=element;
break;
}
}
else
{
if(temp->Rc!=NULL)
temp=temp->Rc;
else
{
temp->Rc=element;
break;
}
}
}
}
}

---------------------------
OutPut...

Enter one (int) data:-20

Eneter another element(y/n):=y

Enter one (int) data:-17

Eneter another element(y/n):=y

Enter one (int) data:-23

Eneter another element(y/n):=y

Enter one (int) data:-6

Eneter another element(y/n):=y

Enter one (int) data:-18

Eneter another element(y/n):=y

Enter one (int) data:-25

Eneter another element(y/n):=y

Enter one (int) data:-5

Eneter another element(y/n):=y

Enter one (int) data:-8

Eneter another element(y/n):=y

Enter one (int) data:-24

Eneter another element(y/n):=y

Enter one (int) data:-29

Eneter another element(y/n):=y

Enter one (int) data:-10

Eneter another element(y/n):=y

Enter one (int) data:-9

Eneter another element(y/n):=n
5    6    8    9   10   17   18   20   23   24   25   29
Enter find next data:-78

element not present
Find another element(y/n):=y

Enter find next data:-17

next data:- 6
Find another element(y/n):=y

Enter find next data:-24

No next element
Find another element(y/n):=y

Enter find next data:-25

next data:- 24
Find another element(y/n):=n

--------------------------------``````

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````private class Node
{
public Node RightNode;
public Node LeftNode;
public int Value;
}

private static int FindNextVal(Node node, int key)
{
var n = Search(node, key);

if (n == null || (n.LeftNode == null && n.RightNode == null))
return -1;

return n.RightNode != null ? n.RightNode.Value : n.LeftNode.Value;

}

private static Node Search(Node node, int key)
{
if (node is null)
return null;

if (node.Value == key)
return node;

if (key < node.Value)
return Search(node.LeftNode, key);
else
return Search(node.RightNode, key);
}

{
var tree = new Node();

return new Node
{
Value = 20,
LeftNode = new Node
{
Value = 15,
LeftNode = new Node
{
Value = 13
},
RightNode = new Node { Value = 16 }
},
RightNode = new Node
{
Value = 25,
RightNode = new Node
{
Value = 45
},
LeftNode = new Node
{
Value = 22
}
}
};
}``````

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.