WXG One Side Cool Sutra

I’m not worthy of WXG, it’s really scary

Duration: 60min
Self-introduction (5min): Mainly talk about the competition experience, and briefly understand some basic knowledge of C++, OS and computing network.

Questions and Answers:
  • Know the difference between C++11, C++17 and C++20?
  • Do you know the STL library for C++? Briefly introduce a few?
  • You say vector vectorThe bottom layer of v e c t o r is an array, please analyze how the system is avector vectorfrom the perspective of the operating systemv e c t o r allocated memory? What kind of memory is allocated? why is it like this?
  • Why are processes more expensive than threads?
  • Since you mentioned creating and reclaiming memory, please answer how the system allocates it? Explain why this is so expensive?
  • How to create/recycle heap memory? Why should it be recycled?
  • Just talked about malloc mallocm a l l o c , may I askmalloc mallocHow can m a l l o c be optimized?
  • You can analyze malloc malloc from the bottomm A L L O C achieved, then answer my question.
Algorithm question (maybe is an algorithm)
  • Find out nnThe top 10 most frequent occurrences among n numbers
  • If nnn There are tens of billions, and it can’t be stored in any way. What should I do? (Hint: the memory is not enough, but you can call the disk)
  • Write a dichotomy
    int n = (int) arr. Size (); int\ \ n=(int)arr.size();i n t n  =( i n t ) a r r . s i z e ( ) ;
    Why do we need to add type coercion? Why assumennn isint intint ?
    i n t    m i d = ( l + r ) > > 1 ; int\ \ mid=(l+r)>>1; int  mid=(l+r)>>1 ;
    you assume thatnnn isint inti n t is right here?
    Answer: uselong long long\ longl o n g l o n g  (tell me not allowed)
    Answer: Useunsigned int unsigned\ intu n s i g n e d i n t  (tell me not allowed)
    Answer: Useif ifi f judgment (tell me not allowed)
    Answer: Use(r − l)>> 1 + l (rl)>>1+l(rl)>>1+l
    Which of the methods you proposed above do you think is the best and which is the worst? Please analyze the reason from the perspective of the operating system?
  • Now I want to send a file, the content is all ASCII characters, how to encode the bit stream?
  • Or to send such a file, there are 64 kinds of characters allowed to be transmitted, how to encode?
    Your method is too expensive, please give me a better one.
    Are the characters in the file a single encoding or multiple encodings?
    How many characters correspond to how many bits is the best? Asked to give me a relatively accurate answer.
    Do you think your code is suitable for real life?
Rhetorical question
  • Thank you, I have no more questions, and the interview can be over. (I just want to escape)
to sum up

Anyway, I keep asking in-depth. I won't be able to get to the first level. The interviewer still tries to guide me to the fifth level. Unexpectedly, the most algorithmic one is dichotomy, which is understood from the perspective of computer basics.

Guess you like

Origin blog.csdn.net/qq_43813163/article/details/114128500