Fundamentals 12 min read

Ctrip Referral, Salary Overview, and CS Fundamentals Interview Guide (C++, OS, Networking, DB, Algorithms)

The article shares a personal Ctrip referral story, recent campus‑recruitment salary figures, and a comprehensive interview guide covering C++ vs Java differences, memory layout, OS concepts, networking fundamentals, database indexing, and a classic min‑stack algorithm problem.

IT Services Circle
IT Services Circle
IT Services Circle
Ctrip Referral, Salary Overview, and CS Fundamentals Interview Guide (C++, OS, Networking, DB, Algorithms)

Yesterday a WeChat friend asked me for a Ctrip referral code; I sent my wife's code, who has been working at Ctrip for four years.

She started as a junior employee, has been promoted once and received two salary raises, and enjoys a relaxed work rhythm with a high salary and good benefits, especially for women.

Ctrip has been a leader in the tourism industry for over twenty years, offers equal pay for testing and development roles, and provides faster promotion for developers while testing roles are less demanding.

Based on offers from the "offershow" mini‑program and reports on Niuke, the 2024 campus‑recruitment salary packages are:

Base package: 22k × 15 months, total ≈ 330k CNY

SP package: 25k × 15 months, total ≈ 370k CNY

SSP package: 28k × 15 months, total ≈ 420k CNY

Compared with previous years, the salary has slightly increased; the author’s wife started with about 20k CNY in the 21st graduating class, and by the 25th class the base is around 22k CNY.

1. Programming Language

1.1 Differences between C++ and Java

Java has no pointer concept and uses true arrays, avoiding out‑of‑bounds memory issues common in C++.

Java replaces C++ abstract classes with interfaces, simplifying implementation and maintenance.

C++ relies on destructors for memory reclamation, requiring explicit allocation and deallocation.

Java performs automatic memory management, eliminating manual fragmentation concerns.

1.2 Memory Partition / Memory Model

Memory is divided into heap, stack, free storage, global/static storage, constant storage, and code segment (see image below).

1.3 Which is faster, heap or stack?

The stack is faster because the operating system provides dedicated registers and simple push/pop instructions, whereas heap allocation requires algorithmic searching and multiple memory accesses.

1.4 New features of C++11

auto and decltype for type deduction

Range‑based for loops (for(auto& i : container))

Initializer lists for classes and structs

Lambda expressions

std::forward_list (singly linked list)

Rvalue references and move semantics

Default member initialization

Smart pointers and other utilities

2. Operating System

2.1 Four necessary conditions for deadlock

Mutual exclusion

No preemption

Hold and wait

Circular wait

2.2 Where are local, global, and dynamically allocated variables stored?

Local variables reside on the stack, global variables in the static/global data area, and dynamically allocated data on the heap.

2.3 Difference between processes and threads

1) Threads start faster and are lightweight. 2) Processes incur higher system overhead. 3) Threads require careful handling of data consistency; processes do not share memory. 4) Threads share heap, global/static variables, pointers, and files, but each has its own stack.

3. Computer Networks

3.1 Issues HTTPS solves for HTTP

1) Hybrid encryption prevents eavesdropping by using asymmetric keys to exchange a symmetric session key. 2) Server computes a hash of the content; the client verifies the hash to ensure integrity. 3) Public key certificates signed by a CA prevent man‑in‑the‑middle attacks.

3.2 How to achieve reliable transmission over UDP

The simplest method is to implement reliability at the application layer, mimicking TCP:

Add sequence/acknowledgment numbers.

Maintain send and receive buffers with timeout‑based retransmission.

Implement timeout and retransmission logic.

When sending, generate a random sequence number, segment data, and include the seq in each packet; the receiver acknowledges each seq, and the sender removes acknowledged data from its buffer, retransmitting after timeouts.

3.3 OSI seven‑layer model

Physical layer: Provides physical connection for bit‑stream transmission. Data link layer: Frames bits from the physical layer and forwards them upward. Network layer: Maps network addresses to physical addresses and selects routing paths. Transport layer: Offers reliable end‑to‑end data transfer. Session layer: Manages session establishment, maintenance, and termination. Presentation layer: Handles data representation, encoding, compression, and encryption. Application layer: Provides network services to user applications.

4. Databases

4.1 Why MySQL uses B+ trees for indexes instead of hash tables or B‑trees

Hash tables require loading all data into memory, which is impractical for large datasets; B+ trees load nodes incrementally, reducing memory usage.

B+ trees maintain ordered leaves linked together, making range queries efficient, whereas hash tables excel only at single‑value lookups.

Non‑leaf B+ tree nodes store only key ranges, allowing higher fan‑out and shallower trees, thus fewer I/O operations compared to B‑trees.

5. Algorithms

5.1 "Offer" problem: Stack with getMin operation

A classic interview question: design a stack that can return the minimum element in O(1) time.

C++Operating SystemsDatabasesInterview PreparationAlgorithmsnetworkingSalary Insights
IT Services Circle
Written by

IT Services Circle

Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.