Review of basic knowledge of C + + (III.)

Source: Internet
Author: User
Tags shallow copy

43. Several ways of inheriting:

A: Common inheritance, protection of inheritance protected, private inheritance. The latter two types of inheritance change the original access level.

44. Deep copy and shallow copy:

A: A simple understanding, deep copy of their own application of memory, shallow copy of the address copied directly to the past.

Whether C + + supports parameter numbers is indeterminate:

A: Support, you can use the hidden parameter mechanism to implement.

46. What is an inline function:

A: The declaration or definition inside a class declaration is called an inline function in order to resolve the efficiency of a function call. The inner declaration of a class declaration, externally defined, is called the display inline function, which is defined inside the class declaration as an implicit inline function. The inline function does not allow loops and switch, as contained, to be treated as a normal function.

47. What is a reference parameter:

Answer: Remember what is a quote? The alias defined by &, when passed as a function parameter, is called a reference parameter, such as swap (int a,int b) cannot be exchanged, but swap (int &a,int &b) is available, actually the operating address.

48. Characteristics of static member functions:

A: There is no this pointer, only in the compilation unit where the file is used, cannot be used by other files, can only access static variables.

49. When overloading overload, the matching rules for the arguments:

Answer: Exact match type promotion "standard conversion" class type conversion.

Templates and STL sections:

50. Templates are divided into function templates and class templates.

The STL is a standard C + + library, and the container is an important part of it. It provides both sequential and associative containers, as well as an iterator and more than 100 algorithmic implementations, including sequencing and convenience. The main containers provided are vector,list,deque,set,multiset,map,multimap.

sequential containers in a. STL:

The associative container in the STL: SET,MULTISET,MAP,MULTIMAP, note that the difference is whether the key value is allowed to be duplicated. Set saves only one value, and map saves a pair.

STL Container Adapter: Just a variant of the container, not alone. Stack,queue, and Priority_queue.

55. The iterator has already defined two,. begin () and. End (), note that end points to the next position of the last element, not the element of the container.

Data Structure section:

56. Basic data structure includes: list, queue (FIFO), Stack (LIFO), tree, graph.

57. Tree classification: Ordered tree, unordered tree. Tree noun: node, node degree (degree), leaf (leaf), Child (children), parent node (parent), sibling (sibling), level of node, depth (depth), forest (forest), Path, ancestor (Ancestor), descendant (descendant)

58. How to traverse the tree: depth-first traversal and breadth-first traversal, respectively, corresponding depth-first search DFS and breadth-first search BFS.

59. Two cross-tree traversal: There are three main types, the first sequence traversal, the sequence traversal and the post-order traversal.

60. Calculate the height of the binary tree: The post-sequential traversal is more suitable for whiteboard questions.

61. How the graph is implemented: adjacency Matrix and adjacency list.

62. Graph Search algorithm: The same is the depth first and breadth first two algorithms.

63. What are the commonly used sorting algorithms:

For:

Bubbles Sorts bubble sort.

Cocktail ordering, directional bubble sorting, each outer loop at the same time the largest minimum element to pick out, and then adjust the upper and lower bounds, if no swap occurs before exiting the outer loop.

Choose the sort, this is the most willing to use the order of the book, The outer loop is the position, the inner loop is the maximum or minimum value of each pick out.

Merge sort

Review of basic knowledge of C + + (III.)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.