Array of references to references to objects? Skip lists...

I'm trying to hammer out a SkipList ADT by tomorrow night. The structure of my SkipList is basically: A Skip list has a reference to the first SkipListNode. Each SkipListNode has an array of links, where a link of level 1 links to the next node that is at least level 1 (every node is at least level 1), and array of 2 links to the next node down the list that is at least that tall, etc. For the last tallest node in the list, it will have links that are null, as there are no nodes after it which can reach up to its higher level links.
My problem is that as I traverse the list looking for the insert position, I need to keep track of the taller links which may be 'cut-off' by the newly inserted node. Just as with a normal LinkedList, I would want to make the new node point to where these old links pointed, and point the old links to the new node. What I have been trying to do is build an array:
SkipListNode previousLinks[] = new SkipListNode[levelOfTallestNodeInSkipList];
As I traverse a SkipListNode, I over-write the previousLinks[i] with every level i link I encounter. For example say I'm in a level 5 node (currentNode) with key 15. I'm trying to inser key 17. I try the level 5 node's level 5 link and its null, so I would want to make previousLinks[5] = currentNode[5]. I then try currentNode's level 4 link, it's not null but it points to a node with key 47, which is past the insertion point for a node with key 17. So again, I want previousLinks[4] to REFER TO currentNode[4]. Etc, etc... I get down to currentNode's level 1 link and see it links to a node with key 16 and level 1. Ok, this is less than 17 so I make currentNode = key 16 node (which is lvl 1). Then I traverse currentNode's only link- a level 1 link- and see that it links to a node with key 18. BOOM: here's the insert point. I randomly select level 4 for the new node which will hold 17. This means that I will 'cut-off' the level four link of the node holding key 15. What I want to be able to do is:
/*connect new links to where old links point to*/
for (int k = 0; k < newNode.level; k++) {
if (k < current.level)
newNode.links[k] = previousLinks[k];
else
newNode.links[k] = null;
/*connect old links to newly created node*/
for (int k = 0;
k < Math.min(current.level, newNode.level); k++)
previousLinks[k] = newNode;
But this doesn't work. The previousLinks array seems to only hold the values which were copied from the earlier nodes, not references to the fields in the nodes which point further down the list. What I want is a C++ style array of pointers to fields in an object's array so that I can change where these fields point (refer).
I hope this post makes enough sense for someone to at least give me a clue... thanks.

My skiplist implementation has a method to lookup a node. The resultant array of nodes has length the maximum height of the skiplist. At each level the array containes a reference to the node prior to the one I am looking for at that level. This allows me to patch all the relevant nodes when I add/remove an item to/from the skiplist.
My code might help give you the idea.
     * Looks up the payload in the list returning an array
     * of nodes that point to the element immediately before
     * the desired element.
     * @param target the node we are searching for
     * @return and array of Nodes that are just prior to the
     * node we are looking for.
    private Node[] lookup(Node target)
        Node[] update = new Node[MAX_HEIGHT+1];
        int k = m_height;
        Node p = m_header;
        do
            Node q = null;
            while (((q = p.getNext(k) )!= null) && (m_comparator.lessThan(q, target))) p = q;
            update[k] = p;
        }  while (--k >= 0);
        return update;
    }

Similar Messages

  • Closing references to front panel objects

    Short version of my question: are programmatically generated references to front panel objects (controls, etc.) automatically disposed of when the VI exits?
    More details: I'm recursively retrieving references to all the controls on the front panel.  (I say recursively because I'm also getting the individual controls from clusters, subclusters, and so on.)  I then return an array of control references, which does not include the references to clusters--only standalone controls or the actual controls themselves contained in clusters.
    Do I need to explicitly close the references to clusters that this VI generates, or is it unnecessary since the VI will run briefly, return an array, and then exit?
    Or another scenario: in a subVI I open a reference to the parent VI.  Do I need to close that reference at the end of the subVI, or is it pointless because the reference will be disposed of when the subVI exits anyway?
    (I did find this article, which I think addresses my question, but I'm not sure.)
    Thanks,
    peppergrower 

    http://forums.ni.com/ni/board/message?board.id=170&thread.id=159571&view=by_date_ascending&page=1
    Jean-Marc
    Jean-Marc
    LV2009 and LV2013
    Free PDF Report with iTextSharp

  • Reference to FLVPlayback Skin object

    So I have a problem with the FLVPlayback. I'm using a
    customized version of the SteelOverPlaySeekMute skin, and it works
    very well. The only problem is, that Macromedia coded the
    FLVPlayback.skinAutoHide poorly, in that it only hides when an
    onRollOut is triggered for your FLVPlayback. However, if the
    FLVPlayback is the same size as your Stage, this will NEVER get
    triggered. I'm finding a way around this by using a MouseListener
    with a setInterval to hide the controls by changing the
    FLVPlayback.skin to an empty string, and then back to my custom
    skin when the mouse moves again. However this is a very clunky
    method of handling it, and when the skin first loads back again
    after hiding, the playback handle is at the begining and then jumps
    to the right position. It's kinda ugly.
    So is there any way to reference my skin object so I can set
    the _alpha property or something, or do I need to go and code my
    own custom UI?

    Hi all ,
    I'm totally no where by this statement :
    " In Practice, a reference argument is anothercopy
    y of a reference to the Orginal object "
    can any one please explain me further ?In Java there are two kinds of variables. Onewhich
    holds the value of a primitive (like say an int)and
    another which holds a reference to an object.
    Both types of variables are passed in the same wayto
    methods. A copy of the content of the variable is
    assigned to the method parameter. So in the case ofa
    primitive it's a copy of a value and in the caseof
    an object its a a copy of a reference.Sorry , But I remember I read in java all the
    arguments are by Value and NOT by reference .....
    Is that diff for object and primitive type ?Arguments are passed by value.
    As UJ said, that value might be a primitive, or it might be a reference. A variable's value is NEVER an object in Java.
    http://javadude.com/articles/passbyvalue.htm
    http://java.sun.com/developer/JDCTechTips/2001/tt1009.html#tip1
    http://www.javaranch.com/campfire/StoryPassBy.jsp
    http://www.javaworld.com/javaworld/javaqa/2000-05/03-qa-0526-pass.html
    http://www-106.ibm.com/developerworks/library/j-praxis/pr1.html
    http://www.cs.toronto.edu/~dianeh/tutorials/params/
    http://java.sun.com/docs/books/jls/second_edition/html/classes.doc.html#38698
    http://radio.javaranch.com/channel/val/2004/05/21/1085125887000.html

  • Sales order with reference to a custom object

    Hi all experts, I have a question.
    I want to create a sales order with reference to a complete custom object created in the CRM system. The custom object has a unique number assigned to it. How can I use the reference of this custom object in my sales order?
    In other words, can I use a field in the sales order which will be storing this custom object number? If yes, which field can be used? If no, how else can this be achieved? Thanks in advance.

    Animesh,
    You have two options:  Use the external reference number field on the Sales order if it is not be being used, however if you capture the customer's PO number you are probably aleady using that field.  Otherwise I would do what you said and create a new Z-field via the EEWB and store your external reference number there.
    If the custom object number was 10 digits alpha numeric, you could possibly create a custom partner function, but I really don't recommend it.  The z-field will give you better performance for reporting, and future processing.  I would put the z-field field in the CUSTOMER_H segment of the document.
    Take care,
    Stephen

  • Error: demo.model.AppModule: Application module demo.model.AppModule has a view instance EmpByEmail1 that references an invalid view object.

    Error: demo.model.AppModule: Application module demo.model.AppModule has a view instance EmpByEmail1 that references an invalid view object.
      intially i created view object named EmpByEmail.........for that EmpByEmail1 is created in datacontrols....i deleted EmpByEmail in demo.model by mistake and i created again with same name EmpBYEmail another view object...again another EmpByEmail2 is created in datacontrols.....
    while i am running i am getting following error:::::::
    Error: demo.model.AppModule: Application module demo.model.AppModule has a view instance EmpByEmail1 that references an invalid view object.

    Hi,
        Please seasrch for the EmpByEmail1 file in ur project and remove all the details in the Page Def and UI and then try again.
    Due to the EmpByEmail1 existance in page Def this may occur . It may help , still if it was not working then I am sorry for that.

  • Can one reference points to many objects?

    HI friend:
    Can I use one object reference points to all objects defined in same class? Because sometimes I only want to access some instance methods and they require a object reference to access. And it doesn't matter which object it is. For example:
    I have a table class:
    public class Table
    int tableNo;
         int tableSize;
         String tableSta;
         String reserName;
         public Table(int n, int s, String c)
              tableNo = n;
                        tableSize = s;
                        tableSta = c;
    Somewhere in the future, I will define a search method (a non-static method) inside table class and it doesn't really matter which object I use to call this method. Because the searching target is all the objects of this Table class. Is it possible to create 50 table objects from another class and use one object reference points to all these objects created and use that reference to access the search method?
    Here is the coding in another class:
    for (int i=1; i<=20; i++)
                   table = new Table(i, 2, "vacant");
                   for (int i=21; i<=30; i++)
                   table = new Table(i, 4, "vacant");
    for (int i=31; i<=50; i++)
                   table = new Table(i, 8,"vacant");
    Can I use table as object reference to access search method?

    Because if the method is static, it can't process instance variables, such as Table objects. But when I implement the search() method, it should search all table objects. That's why I don't want make the method static. :-)

  • BSP Exception: Missing reference when converting data object ZZxx

    Hi there,
    I have created these new Z fields and tried to include them in a field group. These fields did appear, but they are highlighted with a red box, with the above text in the tool tip.
    Does anyone know what it means??
    Thanks

    I believe they were generated by EEWB - or could've been added manually to the CRMD_CUSTOMER_H. This error only occurs on the Currency fields...something to do with reference field but I just can't find what is wrong with this. I searched up SAP notes and found the following the closest match: -
    <b>Symptom</b>
    when trying to scroll down in the result list in the F4 for the Ibase the error error "BSP exception : Missing reference when converting data object amount.  Correct the entry" occurs.
    <b>Other terms</b>
    CRMT_BSP_IBASE_TREE_NF, data object amount
    <b>Reason and Prerequisites</b>
    This happens due to inconsistancy in structure
    <b>Solution</b>
    Please follow the below steps manually.
    1. Go to tx:SE11
    2. Select data type "CRMT_BSP_IBASE_TREE_NF" in change mode
    3. Select component AMOUNT in 'Components' tab
    4. Go to "Currency/quantity fields" tab
    5. Replace 'Reference table' entry from 'CRMT_BSP_IBASE_DETAIL'
       to 'CRMT_BSP_IBASE_TREE_NF'
    6. Save and activate

  • Reference object structure list iam getting only functional location no

    Dears
    There is one query from our client that in reference object structure list he is getting only functional location no and not functional location description.i asked him to go to menu settings field selection -functional location and from the choose list  ask him to select functional location description .But still he couldn't get the required one. Can any body tell me the reason.

    Hi,
    You can achieve it from OIAJ tcode and set the required setting for your field IFLO-PLTXT.
    Regards,
    Keerthi

  • Mv references a synonym in the FROM list

    i want to create fast refreshable MV using synonym.
    First of all it does allow to create fast refreshable MV using synonym.
    I have created MV using force option.
    While using DBMS_MVIEW.EXPLAIN_MVIEW to know capability of the MV , i found that "REFRESH_FAST" is not possible due to "mv references a synonym in the FROM list" .
    But while i communicated with Metalink it answered me that "There is no indication that use of a synonym is restricted in this case. "
    So i need help here .
    Would it be possible to create fast refreshable MV using synonym or any other way around ?

    Yes i reported this fact that fast refreshable MV is not allowed on synonym in 9.2 but at first communication they said that there is no such restriction, but when sent output of MV_CAPABILITIES_TABLE for that MV when restriction was mentioned like fast refresh not allowed due synonym then they lastly said that this restriction is there in 9i and even in 10.1 release. in 10.2 it has been removed.
    Anyways Thanks for your reply.

  • [MaterializedView] : "mv references a synonym in the FROM list "

    I want to create fast refreshable MV using synonym.
    First of all it does allow to create fast refreshable MV using synonym.
    I have created MV using force option.
    While using DBMS_MVIEW.EXPLAIN_MVIEW to know capability of the MV , i found that "REFRESH_FAST" is not possible due to "mv references a synonym in the FROM list" .
    But while i communicated with Metalink it answered me that "There is no indication that use of a synonym is restricted in this case. "
    So i need help here .
    Would it be possible to create fast refreshable MV using synonym or any other way around ?

    Yes i reported this fact that fast refreshable MV is not allowed on synonym in 9.2 but at first communication they said that there is no such restriction, but when sent output of MV_CAPABILITIES_TABLE for that MV when restriction was mentioned like fast refresh not allowed due synonym then they lastly said that this restriction is there in 9i and even in 10.1 release. in 10.2 it has been removed.
    Anyways Thanks for your reply.

  • Number Range object skipping numbers SAP

    Hi All,
    Number Range object skipping numbers SAP "EINKBELEG" . While creating Purchase order with transaction code me21n, the purchase order is skipping odd numbers. I have checked the transaction code "SNRO" there is no buferring set on the object.
    Please help

    Are multiple users creating Purchase Orders at the same time?
    If yes then this is possible. Because Number Range (unique Number) is assigned to Purchase Order at the start of the Transaction (ME21N).
    Thus if multiple users are creating Purchase Orders at the same time & some of these users may have not saved the Purchase Order after partially creating it... This may lead to particular Number Range to be skipped as the following number is already assigned to some other Purchase Order.
    Hope this helps,
    Thanks,
    Jignesh Mehta

  • Need to sort an object array using an element in the object.

    hi all,
    i need to sort an object array using an element in the object.can someone throw some light on this.
    Edited by: rageeth on Jun 14, 2008 2:32 AM

    [http://java.sun.com/docs/books/tutorial/collections/interfaces/order.html]

  • UnsupportedOperationException Error while removing object from List

    Hi,
    I need to remove a set of objects from List if it contains similar objects as the other one.
    Follwing is the code snippet of the above scenario...
    List selectedPaxList = new ArrayList();
    TreeSet seatAssignedPaxlist= new TreeSet();
    selectedPaxList.add("1");
    selectedPaxList.add("2");
    selectedPaxList.add("3");
    seatAssignedPaxlist.add("1");
    seatAssignedPaxlist.add("2");
    if(selectedPaxList.containsAll(seatAssignedPaxlist))
    selectedPaxList.removeAll(seatAssignedPaxlist);
    If i do this in java program it executes fine without any error.But if I do the same in JSP I am getting the following error......
    java.lang.UnsupportedOperationException
    at java.util.AbstractList.remove(AbstractList.java:167)
    at java.util.AbstractList$Itr.remove(AbstractList.java:432)
    at java.util.AbstractCollection.removeAll(AbstractCollection.java:351)
    Plz... help me to resolve the issue

    java.lang.UnsupportedOperationException
    at
    java.util.AbstractList.remove(AbstractList.java:167)
    at
    java.util.AbstractList$Itr.remove(AbstractList.java:43
    2)
    at
    java.util.AbstractCollection.removeAll(AbstractCollect
    ion.java:351)
    That stack trace looks wrong to me.
    ArrayList overrides the remove method, so it
    shouldn't be using the method in AbstractList. That's what I thought, too. There is either something missing or it's not an ArrayList. In fact the javadoc of AbstractList.remove sais:
    "This implementation always throws an UnsupportedOperationException."
    So it really looks like another subclass is used.
    Also
    the object it is trying to remove is a list (from
    your exmaple it should be a String)
    I could be wrong.These are just the code references not the parameters, I think.
    -Puce

  • Cannot Cast List ? extends Object as List Object

    I apologize if this is a common question but I could not seem to find the proper set of search terms that yielded an answer.
    Basically I have an RMI application and on the 'middle-tier' I would like to pass around references to the implementation objects and only convert to the interface type when dealing with them over RMI (I never pass an object back to the middle-tier).
    public interface Questionnaire implements Remote {
        public List<? extends Comment> getComments() throws RemoteException;
    public class QuestionnaireImpl extends UnicastRemoteObject implements Questionnaire {
        public List<CommentImpl> getComments() {...}
    }This works fine, the issue arises when I try to do the following:
    public List<Comment> getComments(int questionnaireId) throws RemoteException {
        return classLoader.getQuestionnaire(questionnaireId).getComments();
    }The compiler issues a Type mismatch: cannot convert from List<capture#8-of ? extends Comment> to List<Comment> Which I find perplexing as the compiler can assure that at the very least it is a List of Comment objects.

    public List<? extends Comment> getComments() throws RemoteException;
    public List<Comment> getComments(int questionnaireId) throws RemoteException {
    return classLoader.getQuestionnaire(questionnaireId).getComments();
    The compiler issues a Type mismatch: cannot convert from List<capture#8-of ? extends Comment> to List<Comment> Which I find perplexing as the compiler can assure that at the very least it is a List of Comment objects.Yes, however Java's generics work correctly to prevent you from shooting yourself in the foot. If you have a List<Superclass> pointing at a List<Subclass>, you would be entirely within your rights to try to store an object that is not castable to Subclass in it, this breaks type safety, so the compiler will not let you do it.
    Instead, create a new List<Supertype> and copy over the elements from the list returned by getComments(). There is a constructor that will do this for you.

  • Kernel Panics: Corrupt Skip Lists

    I recently upgraded my eMac's hard drive to a 160 GB hard drive. Before my eMac was very stable. I experienced maybe one or two kernel panics before upgrading. Now, they are a frequent experience. The curious thing is that all report the same error- "Corrupt Skip Lists". Yet, I cannot find any reference to this error anywhere. Also, I was running Panther before upgrading and switched to Tiger after installing the new drive. I suppose this could also be a factor. The odd thing is that these occur even when it's not running (has booted) off the new internal drive sometimes.
    Here are some screen shots I've taken:
    http://gamoe.net/imagebank/Other/eMacError/KernelPanic1.jpg
    http://gamoe.net/imagebank/Other/eMacError/KernelPanic2.jpg
    Any clues on this?

    Interesting. A topic probably only for the more technically minded. Thank you for your response. I hadn't gotten any leads until now, even though I've posted about this elsewhere. Of course I added more RAM, it's the only decent thing to do, given Apple's traditional skimping on built-in/included RAM.
    So I did as you suggested. I dug up the Apple Hardware Test CD, but it came up with nothing. I then downloaded and ran Memtest in the suggested single user mode under root. I had no idea it would take as long as it did, though I should have known, as it is an thorough test. I used the default suggested 3 passes. Results are as follows.
    Test 1 gave me:
    Bit Flip: FAILURE: 0xfffff3ff != 0xfffff7ff at offset 0x02c53b8b.
    Test 3 gave me:
    Stuck Address: FAILURE: possible bad address line at offset 0x00e52b8b.
    Resulting in these conclusions:
    * Address Test Failed * One or more DIMM address lines are non-functional.
    * Memory Test Failed * Please check logfile for details.
    Actually, I really have had no way of knowing if it was the hard drive or not. When I upgraded I also switched to Tiger, so it could be either. I must say that I am more a little surprised at the results, given that I installed this memory almost immediately after I bought the eMac, and it is Crucial RAM, which is known for quality, and it is the same RAM Apple uses for Macs. I've had absolutely no problems like this in the two years plus I've been using my eMac, under different versions of Mac OS X.
    Given these results, can one reasonably conclude that the memory is responsible for the kernel panics? And, provided that the eMac has panicked even when it has not been booted up from the new internal drive, would you completely rule out the internal hard drive as the cause?-- Or can there be more to this?

Maybe you are looking for