Products
Features
YouTube Video Summarizer
Summarize YouTube videos
Web & PDF Highlighter
Highlight web pages & PDFs
Chat with PDF
Ask any PDF questions with AI
Ask AI Clone
Chat with your highlights & memories
Audio Transcriber
Transcribe audio files to text
Glasp Reader
Read and highlight articles
Kindle Highlight Export
Export your Kindle highlights
Idea Hatch
Hatch ideas from your highlights
Integrations
Obsidian Plugin
Notion Integration
Pocket Integration
Instapaper Integration
Medium Integration
Readwise Integration
Snipd Integration
Hypothesis Integration
Apps & Extensions
Chrome Extension
Safari Extension
Edge Add-ons
Firefox Add-ons
iOS App
Android App
Discover
Discover
Ideas
Discover new ideas and insights
Articles
Curated articles and insights
Books
Book recommendations by great minds
Posts
Essays and notes from readers
Quotes
Inspiring quotes collection
Videos
Curated videos and summaries
Explore Glasp
Glasp Newsletter
Weekly insights and updates
Glasp Talk
Interview series with great minds
Glasp Blog
Latest news and articles
Glasp Use Cases
Learn how others use Glasp
Build & Support
Glasp API
Access Glasp's API for developers
MCP Connector
Connect Glasp to Claude & ChatGPT
Community
Glasp Reddit Community
Students
Student discount and benefits
FAQs
Frequently Asked Questions
AboutPricing
DashboardLog inSign up

Mock Interview | 295 Find Median from Data Stream

963 views
•
October 4, 2020
by
Fraz
YouTube video player
Mock Interview | 295 Find Median from Data Stream

TL;DR

A practical coding interview on finding the median in a dynamic data stream is demonstrated.

Transcript

hey there welcome back to lead coding today i am with ajay and we have planned something for you guys so we are going to replicate an actual programming interview and uh today it's my turn to be the interviewer and ajay will be the interviewee so i will just provide him a problem statement and then he will try to come up with the most optimal solut... Read More

Key Insights

  • 🦕 The median is defined differently based on whether the total number of elements is odd or even, affecting the calculation approach.
  • ⌛ Using a brute force approach to sort the entire array is inefficient for real-time data streams and can be improved through better algorithms.
  • 😫 The conversation focuses on using sets for dynamic data, leveraging their O(log n) insertion efficiency over arrays.
  • 😑 Implementing a system to classify elements into two groups (lesser and greater) relative to the median can streamline median finding.
  • 👨‍💻 The interview illustrates the process of interactive problem-solving typical within coding interviews.
  • 🙃 Challenges in maintaining balance between the two sides of the median prompt creative solutions involving counting frequencies and cumulative sums.
  • 🧑‍🏭 The implementation of priority queues is highlighted as an alternate method for potentially reducing constant factors in operation time.

Install to Summarize YouTube Videos and Get Transcripts

Explore YouTube Video Summarizer or Get YouTube Transcript Extractor

Questions & Answers

Q: What is the initial problem statement presented in the interview?

The initial problem is to determine the median of an array of numbers. The interviewee must explain how to do this given a set of numbers and how to compute the median as more numbers are added continuously.

Q: Explain the brute force approach discussed for finding the median.

The brute force approach involves sorting the array each time a new number is added and then calculating the median from the sorted array. This entails a time complexity of O(n log n) due to repeated sorting, making it inefficient for larger streams of data.

Q: How does the interviewee propose to optimize the brute force approach?

The interviewee suggests inserting new numbers into their correct position in a sorted array, which involves using binary search to find the appropriate index. However, while this optimizes the insertion process, the complexity remains O(n) for insertion due to needing to shift elements.

Q: What alternative data structures do the participants suggest for better efficiency?

The participants propose using two heaps (min-heap for the larger half of numbers and max-heap for the smaller half), which can maintain the median in O(log n) time for insertion and O(1) time for retrieval, hence optimizing the overall approach to finding the median.

Summary & Key Takeaways

  • The video features a mock programming interview where one participant interviews the other on how to find the median of a continuously updated array.

  • Various approaches to solving the median problem are discussed, starting from a basic brute force method to more efficient techniques using sets and binary search.

  • A challenge is posed at the end, focusing on optimizing the median calculation given a constrained range of inputs.


Read in Other Languages (beta)

English

Share This Summary 📚

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Explore More Summaries from Fraz 📚

Don't Ignore Aptitude | Plan for Aptitude Round | Which Companies ask Aptitude Questions thumbnail
Don't Ignore Aptitude | Plan for Aptitude Round | Which Companies ask Aptitude Questions
Fraz
From Selling Vegetables To Cracking Placements ( SDE ) 🔥 | Without JEE Exam | Off-Campus Offer thumbnail
From Selling Vegetables To Cracking Placements ( SDE ) 🔥 | Without JEE Exam | Off-Campus Offer
Fraz

Summarize YouTube Videos and Get Video Transcripts with 1-Click

Download browser extensions on:

Try YouTube Summary with ChatGPT & Claude or YouTube Transcript Generator

Apps & Extensions

  • Chrome Extension
  • Safari Extension
  • Edge Add-ons
  • Firefox Add-ons
  • iOS App
  • Android App

Key Features

  • YouTube Video Summarizer
  • Web & PDF Summarizer
  • Web & PDF Highlighter
  • Chat with PDF
  • Ask AI Clone
  • Audio Transcriber
  • Glasp Reader
  • Kindle Highlight Export
  • Idea Hatch

Integrations

  • Obsidian Plugin
  • Notion Integration
  • Pocket Integration
  • Instapaper Integration
  • Medium Integration
  • Readwise Integration
  • Snipd Integration
  • Hypothesis Integration

More Features

  • APIs
  • MCP Connector
  • Blog & Post
  • Embed Links
  • Image Highlight
  • Personality Test
  • Quote Shots

Company

  • About us
  • Blog
  • Community
  • FAQs
  • Job Board
  • Newsletter
  • Pricing
Terms

•

Privacy

•

Guidelines

© 2026 Glasp Inc. All rights reserved.