Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6918671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:53:22+00:00 2026-05-27T09:53:22+00:00

In Java Software Structures 3rd Edition by Lewis and Chase the array implementation of

  • 0

In Java Software Structures 3rd Edition by Lewis and Chase the array implementation of a heap works for small numbers of items, but in cases with a large number of items sometimes throws a ArrayIndexOutOfBoundsException. It occurs in line 113 of the method heapifyRemove() in ArrayHeap (which extends ArrayBinaryTree).

Line 113:

if ((tree[left] == null) && (tree[right] == null))

It seems that left sometimes walks off the end of the array. How could this be fixed?

For reference:

ArrayHeap.java

ArrayBinaryTree.java

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T09:53:22+00:00Added an answer on May 27, 2026 at 9:53 am

    Before checking if the index for left is null it should check if the the size of the array contains left (from how the array grows it looks like it would always include left and right). I think that case should be interpreted the same as if left and right are null.

    So the the code should be

    if ((left > count) || ((tree[left] == null) && (tree[right] == null)))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing a Java software-project at my university that mainly is about storing data-sets
Here is what I have: JAVA_HOME=C:\Software\Java\jdk1.5.0_12 (points to JDK 5.0) In Eclipse Installed Runtimes
I wrote a piece of software in Java that communicates with USB hardware by
I plan to create 3 editions of a piece of software in Java from
Our software is written in Java and comprise many (7) projects. These projects are
In a software-project written in java you often have resources, that are part of
I have a Java application which requires certain software (one of them being Perl)
what software can help me to unwar a war file and get the java
I am taking a software engineering course and we use Java to implement some
I am developing a security software and want to obfuscate my java code so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.