Rahul
BAN USER- 1of 1 vote
AnswersAn array contains N numbers where N is huge. There are only k distinct numbers. Sort those k numbers.
- Rahul in India
I tld him to use a hashmap for this. He was fine with the solution. But he wanted me to optimise it for a multicore machine. I couldn't come up with an answer. :(| Report Duplicate | Flag | PURGE
SDE-2 Algorithm
- 0 Answers Doubts in child process creation
Hi, I am new to using system calls. As I read somewhere if I create a child process using system call fork(). The child process will contain complete code after the call.
- Rahul May 22, 2013
I wrote:
int main()
{
int i=10;
printf("I am parent %d",i);
fork();
printf("I am chile and parent %d",i);
The doubt is how come the variable i is acessbile in child proces. It should have its own stack| Flag | PURGE
Let me guess...
Heap and Linked List: Answer should be no. Heap is an ordered DS. It can be represented as an array but not as a linked list.
Tree and Linked List: Yes...A linked list can be represented as an inorder traversal(or any traversal for that matter) of Tree.
Hashmap and linked list and tre: No. A hashmap will have to do searching in O(1). Not possible in either tree or linked list
Repcarlawbartlett, Accountant at ASU
Managed a small team managing toy elephants for the underprivileged. A real dynamo when it comes to managing vashikaran mantra ...
@Prashant: Code is pretty simple. Let's do sum mathematics first...
- Rahul May 22, 2013Let a and b are the missing numbers.
{
Sum of 100 num = Sum of 98 num + a +b
=> a + b = (Sum of 100 num ) - (Sum of 98 num ) = x suppose
Product of 100 num = Product of 98 num * a *b
=> a*b = Product of 100 num /Product of 98 num = y suppose
x and y are known. We need to find a and b
a+b = x -----1
a*b = y .......2
(a-b)^2 = (a+b)^2 - 4ab
From 1 and 2
=> a-b = sqrt(x^2 - 4y) = z suppose
a + b = x
=> a = (x+z)/2
b = x - b
}
I dont think any special coding skills neede to write a program for this. :)