willyjlee / 2Sum-and-Median

Medians and 2SUM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Algorithms: Design and Analysis Part I - Stanford

Programming #6

  • Find the medians of the list of numbers
    • O(n2): Use a list to keep track of the sum of medians by getting the middle element
  • 2SUM Problem: Compute the number of target values t in the interval [-10000,10000] such that there are distinct numbers x,y in the input file that satisfy x+y=t.
    • Sort the numbers and scan from both sides of the array for such numbers

About

Medians and 2SUM


Languages

Language:Java 100.0%