Skip to content

Data Structure

Arunkumar S edited this page Dec 2, 2017 · 11 revisions

Arrays

Binary Search:

mid = low + (high - low)/2

Insertion in sorted array:

Ending condition - if low == high + low / 2 (Using binary search)

Find pair for the given sum:

  • hash[sum - val(i)] = val(i)
  • if val(i) in hash

Clone this wiki locally