subroutine Hdelete( Ha, Hj, Hk, Nin, N, Nk, k, hops )
integer(ip), intent(in) :: Nin, Nk, k
integer(ip), intent(inout) :: N
integer(ip), intent(inout) :: Hj(Nin), Hk(Nk)
real(rp), intent(inout) :: Ha(Nin)
integer(ip), intent(out) :: hops
!==================================================================
! Hdelete deletes Ha(k) from heap of length N.
!
! 03 Apr 2002: Current version of Hdelete.
! 01 May 2002: Need Nk for length of Hk.
! 07 May 2002: Protect input parameters N, Nk, k.
! 19 Dec 2004: Nin is new input parameter for length of Hj, Ha.
! 19 Dec 2004: Current version of Hdelete.
! 12 Dec 2011: First f90 version.
!==================================================================
integer(ip) :: jv, kx, Nkx, Nx
real(rp) :: v
kx = k
Nkx = Nk
Nx = N
v = Ha(N)
jv = Hj(N)
N = N - 1
hops = 0
if (k <= N) then
call Hchange( Ha, Hj, Hk, Nx, Nkx, kx, v, jv, hops )
end if
end subroutine Hdelete