Ebook Cracking the coding interview: Part 2

(BQ) Part 2 book "Cracking the coding interview" has contents: Low level, threads and locks, system design and memory limits, networking, moderate, hard, databases,. and other contents. | Part 3 Knowledge Based Chapter 13 | C++ How To Approach: A good interviewer won’t demand that you code in a language you don’t profess to know. Hopefully, if you’re asked to code in C++, it’s listed on your resume. If you don’t remember all the APIs, don’t worry—your interviewer probably doesn’t care that much. We do recommend, however, studying up on basic C++ syntax. Pointer Syntax 1 2 3 4 5 int p = v = Foo int *p; // Defines pointer. &q; // Sets p to address of q. *p; // Set v to value of q. *f = new Foo(); // Initializes f. k = f->x; // Sets k equal to the value of f’s member variable. C++ Class Syntax 1 2 3 4 5 6 7 8 9 10 11 class MyClass { private: double var; public: MyClass(double v) {var = v; } ~MyClass() {}; double Update(double v); }; double Complex::Update(double v) { var = v; return v; } C++ vs Java A very common question in an interview is “describe the differences between C++ and Java.” If you aren’t comfortable with any of these concepts, we recommend reading up on them. 1. Java runs in a virtual machine. 2. C++ natively supports unsigned arithmetic. 3. In Java, parameters are always passed by value (or, with objects, their references are passed by value). In C++, parameters can be passed by value, pointer, or by reference. 4. Java has built-in garbage collection. 5. C++ allows operator overloading. 6. C++ allows multiple inheritance of classes. Question: Which of these might be considered strengths or weaknesses of C++ or Java? Why? In what cases might you choose one language over the other? 75 Cracking the Coding Interview | Knowledge Based Chapter 13 | C++ Write a method to print the last K lines of an input file using C++. _pg 215 Compare and contrast a hash table vs. an STL map. How is a hash table implemented? If the number of inputs is small, what data structure options can be used instead of a hash .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
259    317    5    29-04-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.