Jump to content
xisto Community

spsarolkar

Members
  • Content Count

    5
  • Joined

  • Last visited

Posts posted by spsarolkar


  1. you can add row dynamically using javascript dom

    <html><head><script type="text/javascript">function insRow(){var x=document.getElementById('myTable').insertRow(0);var y=x.insertCell(0);var z=x.insertCell(1);y.innerHTML="NEW CELL1";z.innerHTML="NEW CELL2";}</script></head><body><table id="myTable" border="1"><tr><td>Row1 cell1</td><td>Row1 cell2</td></tr><tr><td>Row2 cell1</td><td>Row2 cell2</td></tr><tr><td>Row3 cell1</td><td>Row3 cell2</td></tr></table><br /><input type="button" onclick="insRow()" value="Insert row"></body></html>


  2. Hey everybody,

     

    I've been stuck on this for the past 4 hours now. I need to write a function that will swap the first and last nodes of a linked list, leaving the middle the same

     

    constraints

    -cannot move data, only the pointers

     

    sample output:

     

    linked list a is: 10 20 30 40 50 60 70

    after swapping: 70 20 30 40 50 60 10

     

    so far i'm only able to get this: 70 20 30 40 50 60

     

    void reverse( node * & s)                              {	if(s == NULL || s->p == NULL)   //0 or 1 node	{		//do nothing	}	else if(s->p->p == NULL)  //2 nodes	{		node *temp = s;		s = temp->p;		temp->p = NULL;		s->p = temp;	}	else	{		node *result = NULL;		node *cur = s;		node *walker;		//reverse order		while (cur != NULL)		{			walker = cur->p;			cur->p = result;			result = cur;			cur = walker;		}		s = result;		result = NULL;		cur = s->p;		s->p = NULL;		//reverse all but first & last node		while (cur->p != NULL)		{			walker = cur->p;			cur->p = result;			result = cur;			cur = walker;		}		s->p = result;	}}

    there's probably a simpler way to do this...but after working on it for so long my brain is fried lol

     

    all i need to do now is figure out a way to get the original first node @ the end of the list

     

    thanks!

    I have rewritten your function

    node *firstNode = s;

    node *lastNode = s->p;

    // make first node as last node

    firstNode->p = NULL;

    //make last node as first node

    lastNode->p = firstNode;

    }

    else

    {

    node *cur = s;

    //reverse order

    node *firstNode=s;

    node *secondNode=s->p;

    node *secondlastNode=NULL;

    while (cur->p != NULL)

    {

    if(cur->p->p==NULL)

    {

    secondlastNode=cur;

    }

    cur=cur->p;

    }

    //make firstNode as last node

    firstNode->p=NULL;

    secondlastNode->p = firstNode;

    //make make last node as first node

    s=secondlastNode->p;

    s->p=secondNode;

    }

    } _linenums:0'>void reverse( node * & s) { if(s == NULL || s->p == NULL) //0 or 1 node { //do nothing } else if(s->p->p == NULL) //2 nodes { node *firstNode = s; node *lastNode = s->p; // make first node as last node firstNode->p = NULL; //make last node as first node lastNode->p = firstNode; } else { node *cur = s; //reverse order node *firstNode=s; node *secondNode=s->p; node *secondlastNode=NULL; while (cur->p != NULL) { if(cur->p->p==NULL) { secondlastNode=cur; } cur=cur->p; } //make firstNode as last node firstNode->p=NULL; secondlastNode->p = firstNode; //make make last node as first node s=secondlastNode->p; s->p=secondNode; }}



  3. <p>I have a website and have inserted flash. However when I preview it on my site it will not start automatically I have to left click to play. When I preview it on my Decompiler premium it works just fine, can some one please help me, I'm so confused! what am I doing wrong? </p>question by Jules

    You have to set focus to the flash when window loads, you can use on load event of window to to do it, as followswrite your body tag as follows
    <body onload='setFocus()'>//html content</body>
    and in javascript write function
    function setFocus(){document.getElementById('myFlashId').focus();}
    replace 'myFlashId' with your id.

  4. There are plent other softwares which are similar to google earth
    you can try out the following links:-

    World Wind - an open source 3D Earth-viewing software developed by NASA that accesses NASA JPL database. World Wind lets you zoom from satellite altitude into any place on Earth. Leveraging Landsat satellite imagery and Shuttle Radar Topography Mission data, World Wind lets you experience Earth terrain in visually rich 3D, just as if you were really there.
    You can download World Wind here

    Blue Marble: Next Generation offers greater spatial detail of the surface and spans a longer data collection period than the original. The original Blue Marble was a composite of four months of MODIS observations with a spatial resolution (level of detail) of 1 square kilometer per pixel.
    You can download blue marble from here

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.