# Data structures Interview Questions

interview questions shared by candidates

## Data structures Interview Questions

Given a (potentially large) array of integers, all but one repeating an even number of times, how would you find the one repeating an odd number of times in an efficient way? eg [1 2 3 3 2 2 1 4 2] should return 4 |

How do you reverse a linked list |

How would you print a linked list in reverse order? |

"Reverse" of the problem if finding k-th smallest element in a tree: I had to find k-th largest. |

I was asked two questions. Q 1. You are given two version numbers of a software, like Version 10.3.4 and Version 10.3.41. Write a program to find out which of the version numbers are the latest. If version 1 is latest output -1, if version number 2 is latest output +1 else output 0 if same version. Both the version numbers are taken as string. He also asks to make the program of minimum time complexity as we can. At the end he also asked the difference between an iterative program and one with recurrence and their advantages and disadvantages. Q 2. Given two files with a list of application IDs (or some kind of data) stored in them , write a program to compare the data in the two files and output all the common data found in each. What data structure would you use and why ? Give a minimum time and space complexity algorithm. Why did you choose the particular data Structure or algorithm ? |

Given an infinite stream of numbers, find the top 50 integers. What's the data structure to use, and what's the time complexity. |

Reverse a linked list. |

Write a function that returns the depth of a tree. |

How to print a link list reversely |

Given a singly linked list, how can you find if there is a loop in the list? |

**11**–

**20**of

**117**Interview Questions