Skip to content

kloudkl/coding-interview

Repository files navigation

coding-interview

Coding interview data structure and algorithm

References

  1. Introduction to Algorithms
  2. Cracking the Coding Interview: 150 Programming Questions and Solutions
  3. Elements of Programming Interviews: 300 Questions and Solutions
  1. Press Ctrl+Alt+T on your keyboard to open terminal. When it opens, run below commands to add the ppa:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
  1. Then install gcc 4.8 and g++ 4.8:
sudo apt-get update
sudo apt-get install gcc-4.8 g++-4.8
  1. Once installed, run following commands one by one to use gcc 4.8 instead of previous version.
sudo update-alternatives --remove-all gcc 
sudo update-alternatives --remove-all g++
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 20
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
  1. Now you have the gcc 4.8 with c++11 complete feature in your system. Check out by:
gcc --version
gcc (Ubuntu 4.8.1-2ubuntu1~13.04) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

There's two things you have to do, first you need to setup your compiler, then you need to setup CDT's language processor. Since you didn't mention which compiler you're using, I'll assume it's GCC but the steps will be similar for other compilers. (Note that you need a compiler that supports C++11, of course.)

Setting up the compiler is fairly straightforward:

  1. Right click your project and click Properties

  2. Under C/C++ Build click Settings

  3. Under GCC C++ Compiler, click Miscellaneous

  4. In the Other Flags box, append "-std=c++11" to the list of tokens.

  5. Click Apply and OK At this point you should be able to rebuild your project and get it to run. But CDT still may show errors for C++11 includes. Here's how you can resolve that:

  6. Right click your project and click Properties

  7. Under C/C++ General click "Preprocessor Include Paths, Macros"

  8. Select the Providers tab

  9. There should be an item in the list that says something like "GCC Built in Compiler Settings". Select this entry.

  10. Under the list there's an box that says "Command to get compiler specs." Append "-std=c++11" to this.

  11. Click Apply and then OK.

  12. Back in your Eclipse workspace, select the Project Menu, C/C++ Index, and click "Re-resolve unresolved includes."

About

Coding interview data structure and algorithm

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published