Data structure retest interview

The difference between arrays and linked lists

1. The most important difference is the definition of an array when it should be a fixed length, the length and the list is not fixed. Therefore not suitable for an array of dynamic changes in the situation, and the list is suitable.
2. For both of the operation data, for insertion and deletion, is more appropriate list data (the key and find the point of insertion and deletion), and for the array, the insertion and deletion are more troublesome, because of the need to move a portion of the .
3, the array of memory allocated from the storage space from the stack of view, it is more convenient for the programmer, but a small degree of freedom. The list allocated from the heap space, but a large degree of freedom of application management is too much trouble.

Binary tree of degree 2 and the difference

1. The degree of binary tree can be 0, 1 and 2, but of the tree is only 2 degrees 2.
2. binary subtree distinct left and right sub-tree sub-tree, and the tree of 2 subtree about no difference.

The difference with respect to a linear list table

Easier to insert and delete data

Single chain, the purpose of increasing the head node

In order to facilitate operation of the implement, so that the operation of the first node, and consistent with other points

The common feature stacks and queues are

Are restriction insert and delete data at the endpoint, the stack is processed in a terminal, and a terminal inserted in the queue, a delete endpoint

Two basic storage structure

Linear memory structure and Storage Structure

List of advantages and circular list

Insertions and deletions in the list is the time without moving elements, but can not find the corresponding random elements. The advantage that the circular list of tables can be accessed from any portion of a full access point list.

Storing the data structure and logical structure

https://blog.csdn.net/panjiao119/article/details/80663685

Five characteristics of algorithms

1. 2. Feasibility of deterministic finite 3. 4. 5. Input Output

About various sort:

Here Insert Picture Description
Quick description of the sort:

The basic idea is this: Choose a keyword, usually the first. Then sort through the trip, the final to determine a good location for this keyword, and the recording part is divided into left and right keys on the left is smaller than the keywords, the right keywords than big, and then to the child table in two parts this use of the classification

Some will be asked to sort:

1. When the distance table element near the final position, in order to save time, may be employed directly into the sort
2. When the small-scale data, the choice direct insertion sort or selection sort
3. When the base is selected from the ordered time ,, direct insertion sort direct selection sort and
4. when the large-scale data when the fast selection sort, quicksort shortest average time, but in the worst case, is the On2
5. the heap sort require auxiliary discharge space is smaller than the faster, but the two are not the sort of stable.

The difference dfs and bfs
Here Insert Picture Description

The difference between the Dykstra algorithm and Floyd algorithm

From a source point to the remainder of the shortest path of each vertex: Dijkstra (the Dijkstra) algorithm. All the figures to more than a shortest path problem vertices: Floyd (the Floyd) Algorithm

Published 72 original articles · won praise 5 · Views 2820

Guess you like

Origin blog.csdn.net/qq_41115379/article/details/104880190