Code Monkey home page Code Monkey logo

data-structures-algorithms-in-python's Introduction

Data Structures and Algorithms in Python

Overview

This repository contains Python implementations of various data structures and algorithms. The implementations are meant to be educational, so they may be less efficient than the implementations in the Python standard library. Each data structure or algorithm is implemented in its own module, which contains a class with a corresponding name. The corresponding test cases are in the tests module.

Interview: How to Solve Problems

What Are Companies Looking For?

  • Analytical Skills - How can you think through problems and analyse things?
  • Coding Skills Is your code clean, simple, organised and easy to read?
  • Technical Skills/Knowledge - Do you know the fundamentals of the job you're applying for? Do you just memorise things or do you undertand the concepts, the pros and cons of different solutions?
  • Communication Skills - Does your personality fit the company culture? Can you communicate well with others?

Technical Interview Mindmap

Step By Step through a problem

  1. When the interviewer says the question, write down the key points at the top (i.e. sorted array). Make sure you have all the details. Show how organised you are.
  2. Make sure you double-check: What are the inputs? What are the outputs?
  3. What is the most important value of the problem? Do you have time, and space and memory, etc.. What is the main goal?
  4. Don't be annoying and ask too many questions.
  5. Start with the naive/brute force approach. The first thing that comes to mind. It shows that you’re able to think well and critically (you don't need to write this code, just speak about it).
  6. Tell them why this approach is not the best (i.e. O(n^2) or higher, not readable, etc...)
  7. Walk through your approach, comment on things and see where you may be able to break things. Any repetition, bottlenecks like O(N^2), or unnecessary work? Did you use all the information the interviewer gave you? Bottleneck is the part of the code with the biggest Big O. Focus on that. Sometimes this occurs with repeated work as well.
  8. Before you start coding, walk through your code and write down the steps you are going to follow.
  9. Modularize your code from the very beginning. Break up your code into beautiful small pieces and add just comments if you need to.
  10. Start actually writing your code now. Keep in mind that the more you prepare and understand what you need to code, the better the whiteboard will go. So never start a whiteboard interview not being sure of how things are going to work out. That is a recipe for disaster. Keep in mind: A lot of interviews ask questions that you won’t be able to fully answer on time. So think: What can I show in order to show that I can do this and I am better than other coders? Break things up in Functions (if you can’t remember a method, just make up a function and you will at least have it there). Write something, and start with the easy part.
  11. Think about error checks and how you can break this code. Never make assumptions about the input. Assume people are trying to break your code and that Darth Vader is using your function. How will you safeguard it? Always check for false inputs that you don’t want. Here is a trick: Comment in the code, the checks that you want to do… write the function, then tell the interviewer that you would write tests now to make your function fail (but you won't need to actually write the tests)
  12. Don’t use bad/confusing names like i and j. Write code that reads well.
  13. Test your code: Check for no params, 0, undefined, null, massive arrays, async code, etc… Ask the interviewer if we can make assumption about the code. Can you make the answer return an error? Poke holes into your solution. Are you repeating yourself?
  14. Finally, talk to the interviewer about where you would improve the code. Does it work? Are there different approaches? Is it readable? What would you google to improve? How can performance be improved? Possibly: Ask the interviewer what was the most interesting solution you have seen to this problem.
  15. If your interviewer is happy with the solution, the interview usually ends here. It is also common that the interviewer asks you extension questions, such as how you would handle the problem if the whole input is too large to fit into memory, or if the input arrives as a stream. This is a common follow-up question at Google, where they care a lot about scale. The answer is usually a divide-and-conquer approach — perform distributed processing of the data and only read certain chunks of the input from disk into memory, write the output back to disk and combine them later.

Google Interview Video

Data Structures

Arrays

  1. Introduction

Algorithms

data-structures-algorithms-in-python's People

Contributors

gbronca avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.