What do the following statements achieve on a linked list?

 

3Comments
Habib Mohammad Khan @habibkhan
12 Aug 2017 11:03 am

In such question to avoid confusion between nodes , assign some key values to each node..

So say we have : 1 --> 2 --> 3 --> 4 initially..

After executing above code we get : 1 --> 3 --> 2 --> 4..

Means the above code swaps the middle 2 nodes by changing the links..

set2018 @setgate
12 Aug 2017 11:50 am

pls explain with diagram also mention address for list it will be helpful m not gettin by this

shivani @shivani1234
12 Aug 2017 02:05 pm


The given pseudo code is swapping data of cell (i+1) and cell (i+2).

Pages