Hewlett Packard Enterprise | HPE Interview Question: Coding question: "Implement t... | Glassdoor

Interview Question

Internship Interview(Student Candidate)

Coding question: "Implement two operations, 'hasNext()' and

  'next()', that work in O(1) time and use O(log n) space, for a binary tree comprised of 'n' elements."
Answer

Interview Answer

1 Answer

0

The question is inherently wrong. It should have been "... work in AMORTIZED O(1) time". Just "O(1)" time is impossible to achieve.

Interview Candidate on Feb 1, 2017

Add Answers or Comments

To comment on this, Sign In or Sign Up.