shivacherukuri
BAN USERwhen writing code, make sure no lock inside another lock. if that is unavoidable, then take the locks based on lock order..
- shivacherukuri April 19, 2013take to pointers starting one from the beginning and one from the end and traverse them towards the center of the array .while doing that compare and swap..u can finish in o(n)
- shivacherukuri February 20, 2012let say { 1,2,3,3}
here take the sum of all elements :9
and do (n*(n-1))/2 :n is 4 here 4*3 /2 = 6
9-6 is 3..3 is duplicate
without using extra space?any algorithm?
- shivacherukuri February 14, 2012unsigned int ip_str_to_int(char *str) {
unsigned int ip=0;
while(*str) {
ip = (ip *10) + (*str -'0');
*str++;
if (*str && *str++ == '.') //skip period
*str++;
}
return ip;
}
assuming passing valid four octet ip address string..u can add validation part before calling this function.
u may also have to check "int start" 's overflow condition
- shivacherukuri January 19, 2012MAGIC only once..fork returns pid to the parent process so if() will be true for only parent and parent prints MAGIC once
- shivacherukuri January 19, 2012MAGIC only once..fork returns pid to the parent process so if() will be true for only parent and parent prints MAGIC once
- shivacherukuri January 19, 2012in both functions we are calling 20000 * 30000 times only? so how func1 is better?
- shivacherukuri January 19, 2012using stack can do the reverse of linked list other than recursive or manipulating data/pointers
- shivacherukuri January 11, 2012hey..i can tell u the logic that works out for o(n) complexity..
and also assumption here is that pair of 2 elements((1,2)(0,3)..) is the output and input array is sorted
-->take two pointers where one starts from the beginning and other starts from the last element of the array
--> check sum of first and last pointers pointing elements sum if it is equal then print pair of element
--> else move the first pointer to next element and repeat the second statement
and here if u find the sum in the second statement then move the last pointer towards the first pointer and repeat the logic
hope this helps and this algorithm complexity is o(n)
Supposing yahoo.com index page is not a blank page and no error page or message displayed in the browser window..then issue could be in the browser(client program) as it is failed to read and display the data that it has received. press refresh button to re-initiate
- shivacherukuri April 16, 2014the connection to reload the page. .