Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
ExperiencesCoaching
New
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Get started
Rank Data Structures by Trade Lookup Latency
00:00
5 left

Rank Data Structures by Trade Lookup Latency

HardSQL · PostgreSQL

Problem

How does your choice of data structure impact algorithmic complexity in a trading context?

Use the provided benchmark tables to compare valid trade lookup measurements for each data structure. Include only structures with at least two valid measurements.

Output

  1. One row per qualifying data structure
  2. Columns: structure_name, structure_type, complexity_class, operation_name, valid_measurements, avg_latency_us, and complexity_rank
  3. Rank lower average latency first, and sort by complexity_rank, then structure_name

Output details

  • Treat a measurement as valid only when observed_latency_us is non-NULL and sample_size is greater than 0.
  • Use trade_lookup as operation_name when no operation name is present.
  • Round avg_latency_us to exactly two decimal places.
  • Rank structures separately within each operation_name using competition ranking, with equal averages receiving the same rank.

Schema

data_structures
ColumnTypeDescription
structure_idPKINTUnique identifier for the data structure
structure_nameVARCHAR(100)Name of the data structure or index
structure_typeVARCHAR(50)Broad category of the structure
complexity_classVARCHAR(20)Expected lookup complexity
trade_lookup_benchmarks
ColumnTypeDescription
benchmark_idPKINTUnique benchmark measurement identifier
structure_idINTReferenced data structure
operation_nameVARCHAR(50)Operation measured by the benchmark
observed_latency_usDECIMAL(10,2)Observed operation latency in microseconds
sample_sizeINTNumber of lookup attempts in the measurement
measured_atDATEDate of the benchmark measurement
Tablesdata_structurestrade_lookup_benchmarks
Interviewer

Your question is Rank Data Structures by Trade Lookup Latency. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.