Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Help > Vector based he...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 15885 of 16566
Post > Topic >>

Vector based heap in java

by Basanta <mainhoonanjaane@[EMAIL PROTECTED] > Mar 16, 2008 at 10:53 AM

Can anyone help me to complete my following program??

im****t java.util.vector;

class Heap{
        Vector data;
        void insert(Object obj) {
              int loc=data.size();
              data.addatLastLoc(obj);

   while(loc != 0){
        int parent = floor((loc-1)/2);
        Object par = data.getIthElement(parent);
       if(par.compareTo(obj)<=0) break;

       Object temp = par;
       data.replaceIthElement(parent,obj);
       data.replaceIthElement(loc,temp);
       loc = parent;
      obj= data.getIthElement(loc);
}

Object removeMin(){
       int loc = data.size()-1;
        swap(root && loc objects)
        int curr =0;
        int leftchild=curr*2+1;
        int rightchild = curr*2+2;
 




 5 Posts in Topic:
Vector based heap in java
Basanta <mainhoonanjaa  2008-03-16 10:53:33 
Re: Vector based heap in java
Andrea Francia <andrea  2008-03-16 18:38:43 
Re: Vector based heap in java
rossum <rossum48@[EMAI  2008-03-16 22:01:33 
Re: Vector based heap in java
Lew <lew@[EMAIL PROTEC  2008-03-16 21:11:13 
Re: Vector based heap in java
Roedy Green <see_websi  2008-03-17 05:27:22 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 15:54:33 CST 2008.