Data structures and algorithm questions are an important part of any programming job interview, be it a Java interview, C++ interview or any other programming language. Since data structures are core programming concept, it’s mandatory for all programmers, to know basic data structures like stack, linked list, queue, array, tree, and graph. Though tree and graph are on the tough side, I still see programmers get familiar will all these. Any list of programming job interview questions isincomplete without questions from data structures and algorithms. Similarly, while going on questions from data structure you may get some programming exercise as well e.g. swapping numbers without temp variable. The linked list and array are favorite topics in any data structure interview, questions like reversing linked list, traversing linked list or deleting nodes from linked list, which involves algorithm and data structures are quite common. Similarly, finding duplicates in an array, finding missing numbers, sorting arrays are very popular. You can also expect questions from the stack, queue, array, linked list, tree, graph and hash table are most common in any data structure interview. In this tutorial, we will see a couple of data structure questions answers from these topics. Let us know, if you have any interesting questions from data structures and algorithm, which you faced during any Java interviews. I also suggest to look on data structure and algorithm questions on “Cracking the Coding Interview book”, as this book contains some good questions with proper explanation. That will certainly help you to do better on programming job interviews. One more suggestion I have to make is whenever you get some time, just read the “Introduction to Algorithm by Thomas Cormen”, if you have not read already. This book is the bible of algorithm and IMHO every programmer should read this book.
Stars
6
Forks
2
Watchers
6
Open Issues
0
Overall repository health assessment
No package.json found
This might not be a Node.js project
8
commits
add some common searching and sorting algorithm which very important for prgramming interview session
3633bb8View on GitHubsome number theory related problem important for programming interview
6dea3bdView on GitHubsome string operation related problem important for programming interview
dbfb306View on GitHubsome array operation related problem important for programming interview
c3edff8View on GitHubThis is another frequently asked linked list interview question. This question is exactly similar to finding middle element of linked list in single pass. If we apply same trick of maintaining two pointers and increment other pointer, when first has moved up to 3rd element, than when first pointer reaches to the end of linked list, second pointer will be pointing to the 3rd element from last in a linked list.
455bec6View on GitHubThis question has bit of similarity with earlier algorithm and data structure interview question. I mean we can use two pointer approach to solve this problem. If we maintain two pointers, and we increment one pointer after processing two nodes and other after processing every node, we are likely to find a situation where both the pointers will be pointing to same node. This will only happen if linked list has loop.
d45f54bView on GitHubOne of the most popular question from data structures and algorithm, mostly asked on telephonic interview. Since many programmer know that, in order to find length of linked list we need to first traverse through linked list till we find last node, which is pointing to null, and then in second pass we can find middle element by traversing only half of length. They get confused when interviewer ask him to do same job in one pass. In order to find middle element of linked list in one pass, you need to maintain two-pointer, one increment at each node while other increments after two nodes at a time, by having this arrangement, when first pointer reaches end, second pointer will point to middle element of linked list. See this trick to find middle element of linked list in single pass for more details.
3975898View on GitHub