Below is the code:<br><br>Yes it can be done thru linked list also. The concept is : <br>In case of array you pass the index or subscript of the array. While in case of linked list you need to pass the pointer to the node. <br><br>If you need source code , I can try. <br>Does this answer your question ?<br>Thanx<br>Siddhartha Singh<br><A HREF="mailto:ssingh@aztecsoft.com">ssingh@aztecsoft.com</A><br><br>I am giving you the source code of linked list merge sort. Hope it will help in understanding you the logic for binary search.<br><br><br>/*<br>** Here's an example of how to sort a singly-linked list. I think it<br>** can be modified to sort a doubly-linked list, but it would get a bit<br>** more complicated. Note that this is a recursive method, but the<br>** recursion depth is limited to be proportional to the base 2 log of<br>** the length of the list, so it won't "run away" and blow the stack.<br>*/<br><br>#include "snipsort.h"<br><br>/* linked list sort -- public domain by Ray Gardner 5/90 */<br><br>#include <stdio.h> /* for NULL definition */<br>#include <string.h><br><br><br>/* returns < 0 if *p sorts lower than *q */<br>int keycmp (list *p, list *q)<br>{<br> return strcmp(p->key, q->key);<br>}<br><br>/* merge 2 lists under dummy head item */<br>list *lmerge (list *p, list *q)<br>{<br> list *r, head;<br><br> for ( r = &head; p && q; )<br> {<br> if ( keycmp(p, q) < 0 )<br> {<br> r = r->next = p;<br> p = p->next;<br> }<br> else<br> {<br> r = r->next = q;<br> q = q->next;<br> }<br> }<br> r->next = (p ? p : q);<br> return head.next;<br>}<br><br>/* split list into 2 parts, sort each recursively, merge */<br>list *lsort (list *p)<br>{<br> list *q, *r;<br><br> if ( p )<br> {<br> q = p;<br> for ( r = q->next; r && (r = r->next) != NULL; r = r->next )<br> q = q->next;<br> r = q->next;<br> q->next = NULL;<br> if ( r )<br> p = lmerge(lsort(r), lsort(p));<br> }<br> return p;<br>}<br><br>#if 0 /* Not really main(), but a fill-in-the-blanks framework */<br><br>#ifdef __WATCOMC__<br> #pragma off (unreferenced)<br>#endif<br><br>main (void)<br>{<br> list *listp; /* pointer to start of list */<br><br> /* first build unsorted list, then */<br><br> listp = lsort(listp); /* rdg 10/93 */<br><br> return 0;<br>}<br><br>#endif<br><br><br><br><br> <p>Siddhartha Singh<br><a href=mailto:siddhu_singh@hotmail.com>siddhu_singh@hotmail.com</a><br><a href=siddhu.freehosting.net> </a><br>