@snehal jain : *Aim*: return arrary set value by you else by default initialized value..
take three array { int num[], unsigned int from[], to[], {from array will point to "to[] array" } {"to[] array" will point to "index for which retrival is done"} int element_filled } concept is : initally all 3 array contains garbage value . initialize count as 0; // this will count num which are set in num[] *1 case:* now suppose u try 2 get any number at index i in array num[] check from[i]<count result will be false because from is unsigned int array and have always > 0 value as garbage in this case return initialize value... 2 case: when u set a value in array num[i] do this step from[i]=count; to[count]=i; count++ *3.getting result for set value:* when we try get a number from already set index in num[] check if * from[i]<count and to[from[i]]=i* if true return set value .. if false return initialized value.... explanation: if value will be set already then from[i] should be less than current count{which is true if value is actually set by you manually } but problem occurs if garbage value can also do that ..to remove that use condition "to[from[i]]=i;" in this case go to "to[] array" at which from[i] is pointing to if this contain same index i of num[] then return set value else return initialized value . -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.