50 data structure and algorithm interview questions for engineers Translated 100%

oschina Posted at 17:03, December 19, 2018 (20 paragraphs in total, translation completed on 01-02)
Reading 30350
Collection two hundred and thirty-nine
top twenty-three
Loading

Many computer science graduates and programmers have applied for programming, coding and software development positions in start-ups such as Uber and Netflix, large organizations such as Amazon, Microsoft and Google, and service-oriented companies such as Infosys or Luxsoft, but many of them do not know when you apply for jobs in these companies What kind of programming interview questions will you encounter

 Tocy
Translated at 16:19, December 20, 2018
top
zero

In this article, I will share some common programming interview questions from programmers with different experience levels, Including people who graduated from college to programmers with one to two years of experience

The coding interview mainly includes Data structure and algorithm based problems , and some logical problems such as how to exchange two integers without using temporary variables?

 Tocy
Translated at 16:22, December 20, 2018
top
zero

I think it is helpful to divide the programming interview questions into different subject areas. The subject areas I often see in interviews are arrays, linked lists, strings, binary trees, and problems arising from algorithms (such as string algorithms, sorting algorithms, such as quicksort Or Cardinal sort , and other miscellaneous items), which is the main content you can find in this article.

 Tocy
Translated at 16:27, December 20, 2018
top
zero

We No guarantee You will be asked these programming or data structure and algorithm questions, but they will give you a full understanding of all kinds of questions that can be expected in the actual programming job interview.

Once you know these questions, you should have enough confidence to participate in any telephone or face-to-face interview.

 Tocy
Translated at 16:34, December 20, 2018
top
one

By the way, if you Basic data structure and algorithm If you don't know enough, or you haven't contacted relevant knowledge for many years, it is meaningless to try these questions.

In this case, you should learn Excellent courses like Robert Hornick's algorithm and data structure Part 1 and Part 2 To update your data structure and algorithm skills.

 Tocy
Translated at 16:39, December 20, 2018
top
zero

50 algorithm and code interview questions

Less gossip, here is a list of the most frequently asked questions in procedural interviews

1. Array problem

Array is the most commonly used basic data structure, which stores elements in continuous memory. It is also one of the favorite questions in the interview Code interview You will often hear many questions about arrays in, for example, array inversion, array sorting, or finding an element in an array.

A key advantage of array structure is that you can find an element with O (1) complexity when you know the index. But adding or deleting an element is slow, because once you create an array, you cannot change its size.

To create a longer or shorter array, you need to create a new array, and then copy all the elements from the old array to the new array.

 kjmeng
Translated at 17:39, December 19, 2018
top
zero

The key to solving the array problem is to The data structure of array Have a deep understanding, but also understand the basic program flow such as loops, recursion and basic operators.

Here are some interview questions often asked about arrays, which you can use for practice:

  1. How to quickly find missing numbers in a given integer array from 1 to 100? Solution

  2. How to find a duplicate number in a given integer array? Solution

  3. How to find the largest and smallest numbers in an unsorted integer array? Solution

  4. In an integer array, how can I find a pair of numbers whose sum is equal to a given number? Solution

  5. If an array contains multiple duplicate elements, how can I find these duplicate numbers? Solution

  6. Using Java to delete duplicate elements from a given array? Solution

  7. How to sort an integer array using quick sort? Solution

  8. How to delete duplicate elements from an array? Solution

  9. Implement array inversion in Java? Solution

  10. How can I delete duplicate elements from an array without using the library implementation? Solution

These questions can not only help you improve your problem-solving skills, but also help you improve your understanding of array structures.

If you need more questions about the advanced array, you can refer to《 Code interview training camp: algorithm and data structure 》This is an algorithm course in the form of training camp, specially designed for interview preparation of technical giants like Google, Microsoft, Apple and Facebook.

If you feel that 10 questions are not enough and you need more contacts, then take a look at this 30 array problems List of.

 kjmeng
Translated at 23:09, December 19, 2018
top
one

2. Programming of linked list

Linked list It is another common data structure, which is a supplement to the array structure. Similar to an array, it is a linear data structure that stores elements in a linear manner.

However, unlike arrays, the elements of a linked list are not stored in consecutive locations, but are scattered in various locations in various memory and linked through nodes.

A linked list is a list of nodes containing the memory address of the next node.

 kjmeng
Translated at 15:05, December 20, 2018
top
zero

Based on this structure, it is easy to add and delete elements in the linked list, because you only need to change the node's direction without creating a new array. However, it is relatively difficult to find an element in a linked list. It takes O (n) time to find an element in a one-way linked list.

For more information on the differences between linked lists and arrays, please read This article

Linked lists have several different forms. First is the one-way linked list. In this structure, you can only traverse in one direction (forward or reverse); The second is the double linked list, you can traverse in both directions (forward or backward); Finally, there is a ring linked list, in the form of a ring.

To solve the linked list problem, you must understand recursion Because linked list is a recursive data structure.

 kjmeng
Translated at 15:37, December 20, 2018
top
zero

If you remove a node from the linked list, the remaining data structure is still the linked list. Therefore, many linked list problems have simpler recursive solutions than traversal

The following are some of the most common and popular linked list interview questions and solutions:

  1. How to find the intermediate elements of a single linked list in a single traversal? ( answer )

  2. How to verify that a given linked list is circular? How to find the starting node of this ring? ( answer )

  3. How to flip a linked list? ( answer )

  4. How to reverse a single linked list without recursion? ( answer )

  5. How to remove duplicate nodes in an unsorted linked list? ( answer )

  6. How to find the length of a single linked list? ( answer )

  7. How to find the third node of a linked list from the end of a single linked list? ( answer )

  8. How to use the stack to calculate the sum of two linked lists? ( answer )

These problems can help you improve your problem-solving skills and improve your knowledge about linked list data structures

If you still have problems with these linked list coding problems, I suggest you pass Data Structures and Algorithms: Deep Dive **Using Java * * course to improve your data structure and algorithm skills

You can also 30 linked list interview questions Get more exercises in the list

 osc_980576
Translated at 09:54, December 31, 2018
top
zero
All translations in this article are only for learning and communication purposes. Please be sure to indicate the translator, source and link of the article when reprinting.
Our translation work follows CC protocol If our work infringes your rights and interests, please contact us in time.
Loading

Comments( six )

 mickelfeng
mickelfeng
Not bad, worth collecting
 Mao rabbit
Mao rabbit
There's an answer not to climb over the wall
 osc_566335
osc_566335
However, there is no egg to use. The training class will crack you every second. There is no other way but to measure IQ.
 Awesomes
Awesomes

Quote comments from "Broken Style Men"

Do links have to climb over the wall?
Yes, we have to climb over the wall
 Broken style male
Broken style male
Do links have to climb over the wall?
 NickWilde
NickWilde
Not bad, worth collecting
 Back to top
Top