Identify trees, lists, and array search costs

Quick Overview

This question evaluates knowledge of fundamental data structures (tree hierarchies, linear lists, and arrays), algorithmic time and space complexity, and cycle-detection concepts.

Identify trees, lists, and array search costs

Company: Meta

Role: Data Scientist

Category: Coding & Algorithms

Difficulty: medium

Interview Round: HR Screen

Answer all parts concisely and justify time complexities. a) A data model requires each node to have at most two children and a single parent. Name the data structure and describe the typical fields per node. If keys are stored to enable ordered searches, state the average and worst-case time to search by key and what property must hold to achieve the average case. b) You need a structure where each element points to the next element and supports O(1) insertion at the head. Name the structure. Describe how to detect whether it contains a cycle and give the time and space complexity of your method. c) For an unsorted array of n integers, what is the worst-case time complexity to determine whether a target value exists? If the array is sorted, what algorithm would you use and what is the new time complexity? Yes/No: Is binary search valid on an unsorted array? Explain in one sentence.

Quick Answer: This question evaluates knowledge of fundamental data structures (tree hierarchies, linear lists, and arrays), algorithmic time and space complexity, and cycle-detection concepts.

|Home/Coding & Algorithms/Meta
Meta logo
Meta
Oct 13, 2025, 9:49 PM
mediumData ScientistHR ScreenCoding & Algorithms
6
0

Answer all parts concisely and justify time complexities.

a) A data model requires each node to have at most two children and a single parent. Name the data structure and describe the typical fields per node. If keys are stored to enable ordered searches, state the average and worst-case time to search by key and what property must hold to achieve the average case.

b) You need a structure where each element points to the next element and supports O(1) insertion at the head. Name the structure. Describe how to detect whether it contains a cycle and give the time and space complexity of your method.

c) For an unsorted array of n integers, what is the worst-case time complexity to determine whether a target value exists? If the array is sorted, what algorithm would you use and what is the new time complexity? Yes/No: Is binary search valid on an unsorted array? Explain in one sentence.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...