Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

MySmartCoPilot Learn

Data structures, algorithms and coding interviews

How to store data so the operations you need are fast, how to measure that cost, and how to turn a new problem into one you know how to solve.

2 tracks with lessons

Start with cost

Every data structure is a trade. A hash table finds a key quickly on average but does not keep its keys sorted; a sorted array keeps them sorted but makes each insert slow. Learn to state how much time and memory an operation takes before you learn many structures, because every later choice comes back to that question. Big-O notation is the shared language for it.

Practise in the right order

Study a structure, build it once yourself, then solve a few problems that need it. When a problem is new, read its limits first: a million items rule out a loop inside a loop, while twenty items allow almost anything.

Trace your solution by hand on a small input before you run it, and keep a list of the mistakes you repeat, such as an index that is off by one or an empty input you forgot.

A week later, solve the same problem again without looking at your old answer. If you can rebuild it, you have learned the idea and not only the solution.

In an interview

Explain your idea before you write code, say its cost out loud, and test the edge cases at the end. Interviewers judge your reasoning as much as the final answer.

Quick answers and tool search

Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.