You are given a singly link-list such that each node of this list is also a head of another link list of the same type. So, how does one flatten the linked-list struct node { void *data; /* could be anything */ struct node *next; struct node *down; };
Given: 2 Unsorted single linked list Todo: Fastest and optimised way to merge and make a single sorted list with these 2 unsorted single linked list.
Given a numbers x and n, where n is a power of 2, write C code, which gives the multiple of n which is greater than or equal to x. ex : I/P: 13 8 O/P: 16 I/P: 17 16 O/P: 32 The challenge: Do not use division or modulo operator.
In C, copying of array as follows is not possible: int a[10],b[10]; a = b; a = GetAnArrayOfTenElements(); Can you think of a simple hack, which would enable us to get this effect?
Assume that two robots land from two different flights with the help of parachuttes (at different points) on an infinite plane. Each robot leaves its parachutte on landing and goes in search of the other robot. The problem is to write a program which will be executed by both the robots for rendevezvous(meeting). You have the following instructions at your disposal to write the program: 1) Step L - makes the robot take one step towards left 2) Step R - makes the robot take one step towards right 3) goto label - jump to the label 4) if P one instruction, where P is a predicate which will be true when a robot senses a parachutte. It will be true as long as the robot is near it. The moment it takes a step towards left or right after sensing it, then P will become false. As part of 'if' statement one can execute one instruction which could be (1) or (2) or (3) Could anybody write a program to help the robots to meet :)? Make your own assumptions and justify them. Remember the same program needs to be executed by both robots :-)