Golf Clubs Factory Direct Track and Field Books 60+ International Artists
Golf Clubs Factory Direct Track and Field Books 60+ International Artists
Golf Clubs Factory Direct Track and Field Books 60+ International Artists
Suppose, the program is 1.c Then, while compiling $ cc -o 1 1.c int main() { printf("Hello World\n"); } ^D $ ./1 Hello World $
Golf Clubs Factory Direct Complete Set inc Bag from $89.99 Clubs, Bags, Hybrids, Carts on sale
www.golfoutletsusa.com
Track And Field Books Find Local Track and Field Information. View Top Results.
www.AreaConnect.com
60+ International Artists Personalize your iPod, iPhone, Laptop, PSP, DS-lite and more...
www.GelaSkins.com Ads by
a snippet to say whether s2 is a rotation of s1 using only one call to strstr routine? (eg given s1 = ABCD and s2 = CDAB, return true, given s1 = ABCD, and s2 = ACBD , return false)
5. Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence
1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, ... shows the first 11 ugly numbers. By convention, 1 is included. Write a program to find and print the 1500'th ugly number.
6. Write a C program which when compiled and run, prints out a message
indicating whether the compiler that it is compiled with, allows /* */ comments to nest.
7. Write a C function that will print 1 to N one per each line on the stdout
where N is a int parameter to the function. The function should not use while, for, do-while loops, goto statement, recursion, and switch statement.
8. int main()
{ int i, n = 20; for (i = 0; i < n; i--) printf("*"); return 0; } Change/add only one character and print '*' exactly 20 times. (there are atleast 3 solutions to this problem :-)
C++ Computer Programming C/C++/C# Homework Help
Take hands on courses & earn your degree at University of Phoenix. Phoenix.edu
Affordable Help with your C/C++ and C# assignments. Live quote. www.homeworkhelp4u.com/
10. Given a singly-linked, find out the mid point of a single linked list in a
single parse of the list. Assume the program would be loaded in read-only memory so no manipulation of the list is allowed.
11. You are given a circular single linked list of sufficiently many number of
nodes(say more than 1 crore). You need to delete a node say P and you are given a pointer to P in the circular single list. Suggest the most efficient methodology of deleting the node P from the circular single linked list without rounding about the circular single linked list.
13. You are provided with two stacks, and pop() and push() functions for them.
You have to implement queue i.e. enqueue() and dequeue() using the available operations.
15. You are given a sequence of numbers from 1 to n-1 with one of the
numbers repeating only once. (example: 1 2 3 3 4 5). * How can you find the repeating number? * What if i give you the constraint that you can't use a dynamic amount of memory (i.e. the amount of memory you use can't be related to n)? * What if there are two repeating numbers,instead of one (and the same memory constraint?)
16. Given an array of numbers, except for one number all the others, occur
twice. Give an algorithm to find that number which occurs only once in the array.
18. Given a stack S, write a C program to sort the stack (in the ascending
order). We are not allowed to make any assumptions about how the stack is implemented. The only functions to be used are: Push Pop Top IsEmpty IsFull
19. Given a linked list, your are asked to find out the nth last element in
the linked-list. (n would be given as the argument to the function)
20. The numbers are represented in linked-list with each node representing a
digit of the number as follows: 123 == 1 2 3 NULL 999 == 9 9 9 NULL Write a C program to add two numbers. I/P : 9 9 9 NULL 1 NULL
O/P : 1 0 0 0 NULL You can assume that the number of elements in the linked-list is available to you. struct List { Node* head; int noe; /* number of elements */ };
21. There is a 100-story building and you are given two eggs.
The eggs (and the building) have an interesting property that if you throw the egg from a floor number less than X, it will not break. And it will always brake if the floor number is equal or greater than X. Assuming that you can reuse the eggs X in a minimal number of throws. which didn't broke, you got to find
22. 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; };
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 :-)
27. Given the values of two nodes in a *binary search tree*, write a c
program to find the lowest common ancestor. You may assume that both values already exist in the tree. The function prototype is as follows: int FindLowestCommonAncestor(node* root,int value1,int value) 20 / 8 / 4 / 10 I/P : 4 and 14 O/P : 8 (Here the common ancestors of 4 and 14, are {8,20}. Of {8,20}, the lowest one is 8). \ 12 \ 14 \ 22
28. Given an array of 2n elements of which n elements are same and the
remaining n elements are all different. Write a C program to find out the value which is present n times in the array. There is no restriction on the elements in the array. They are random (In particular they not sequential.)
29. Given two arrays A and B. Array 'A' contains all the elements of 'B' but
one more element extra..... Find out the extra element...... Restrictions: Dont use any relational ops ( > or > or == etc....), array elements are not in order ...,
we have 3000 bananas in city A and a elephant can carry max 1000 bananas at any given time and it needs to eat a banana every 1 Km. How Many Max. No. of bananas one can transfer to city B? Note : the elephant cannot go without bananas to eat.
31. Assume memory is divided into blocks that are a power of 2 in size,
starting at address 0. The blocks may be words, doublewords, pages, and so on. Then, given a starting address "A" and a length "L", we wish to determine whether or not the address range from "A" to "A+L-1" crosses a block boundary. The quantities "A" and "L" are unsigned and any values that fit in a register are possible. Pictorially, |---N------|----N-----|----N------| +----------+----------+---- ... ---+----------+ | | | | | +----------+----------+---- ... ---+----------+ ^ |----L---| | | A Write small piece of C code, to know if A+L crosses a boundary. Challenge again is not to use division or modulo operator :-)
34. Prove that n*(n+1)*(2*n+1) is divisible by 6, for any n>0 35. Given an 8x8 chessboard,
* How many "total" number of squares are present in the board? * How many "total" number of rectangles are preent in the board? (for this problem assume that rectangles must have length and breadth different)
+8 5/12 - 2 2/3 Note: 8 5/12 is a mixed fraction. Cannot represent it any better on the monitor What I expect is a step wise description of the procedure. No this is not a test of one's analytical skill, just to see how many people do it the easier way.
37. Consider an array of integers, both positive and negative. You have to
find out the maximum sum possible by adding 'n' consecutive integers in the array, n <= [ARRAY_SIZE]. Also give where in the array this sequence of n integers starts.
38. Given two sorted linked lists, L1 and L2, write a C program to compute
L1 /\ L2 (L1 intersection L2).
39. Propose a data structure that supports the stack push and pop operations
and a third operation find_min, which returns the smallest element in the data structure, all in O(1) worst case time.
41. A man has two cubes on his desk. Every day he arranges both cubes so that
the front faces show the current day of the month. What numbers are on the faces of the cubes to allow this?
42. Given 6 match sticks of equal length. You are asked to form 4
equilateral triangles with these sticks. Obviously, you are not allowed to break, split or bend the sticks.
45. Given 13 balls, how would you arrange them in 9 lines, such
that there are 4 balls in each line ? you can assume that the lines are arranged in 2-D space. cannot be placed on top of another ball. a ball
If you find that too easy, and have loads of time to kill, then how about arranging 22 balls in 21 lines of 4 :)
48. A skier must decide every day she goes skiing whether to rent or buy skis,
unless or until she decides to buy them. The skier does not know how many days she will go on skiing before she gets tired of this hobby. Suggest a strategy for the skier minimizing her cost, given the cost of rent is 1 unit, cost to buy the skis is B units where B>>1.
50. You need to write a simple macro CHAR(x) which takes a character x and
converts it into ASCII value of x.
printf("%c",CHAR(a)) ==> a printf("%c",CHAR(X)) ==> X No, this simple definition doesn't work: #define CHAR(x) 'x'
51. Here is a small one to drive away the afternoon siesta. Consider a point
P(n,n) in the cartesian co-ordinate system A robot has to start from the origin and reach this point. The only steps the robot can take are : 1 unit right 1 unit up. How many different paths can the robot take to point P. Is there an optimal path to point P. (both up and right steps incur the same cost).
53. A multiple choice test has 15 questions and 4 choices for each answer.
Each question has only one answer correct. How many ways can the 15 questions be answered so that - Exactly 3 answers are correct - Atleast 3 answers are correct
54. cwd
xor ax, dx sub ax, dx cwd- convert word ot double word. sign extend DX:AX, with DX having the signed bit xor ax, dx => ax = ax xor dx sub ax, dx => ax = ax - dx
55. In a calendar year (assume non-leap), determine how many Friday the
thirteenths there can be. What is the smallest number possible?
56. Write a Recursive function which generates the PowerSet of a given Set.
The Set is passed to the Function as a String. And the Function should print the Subsets as Strings. [Note:] PowerSet( {1,2,3} ) = 0, 1, 2, 3, 12, 13, 23, 123 And the Order of the SubSets is not Mandatory. Sample TestCase: I/P :"abc" O/P: 0 a b
ab c ac bc abc
http://acm.uva.es/p/v101/10101.html 58. Suppose that there are 101 players entered in a "single elimination"
tennis tournament. In such a tournament any player who loses a match, must drop out, and every match ends in a victory for some player - there are no ties. In each round of the tournament, the players remaining are matched into as many pairs as possible, but if there is an odd number of players left, someone receives a bye (which means an automatic vitory for this player in this round) Enough rounds are played until a single player remains who wins the tournament. The problem is : How many matches are played in total?
60. Calculate: B^P mod M for large values of B, P and M using a very
efficient algorithm. Value ranges: B P M 0-2147483647 0-2147483647 1-46340
61. Lets assume we have a rat maze as represented by the following NxM matrix
where S is the start location and F is the end location. S 1 1 1 0 1 0 0 1 0 0 1 0 1 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 0 0 0 1 1 0 0 0 0 0 0 F
The idea (as with any rat maze) is to traverse from S to F. The matrix can have only 0 and 1 as values. 1 represents a path that can be taken and 0 represents a blocked path. We can make the following assumption: S will always be (0,0) and F will always be (N,M). As seen from above, there can be many paths from S to F. How do we find the shortest (or longest) path from S to F without actually traversing all the possible paths. Please post (with proof/explantion) your algorithms. Also can you then think of ways to optimize the algo?
62.
I. The chicken came first. II. The egg came first. III. Statement I is false and Statement II is true. If two of the above statements are false, what chance is there that the egg came first?
63. #include
main() { int a,b,c; int count = 1; for (b=c=10;a="- FIGURE?, UMKC,XYZHello Folks,\ TFy!QJu ROo TNn(ROo)SLq SLq ULo+\ UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\ NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\ HCStHAUFAgcEAelclcn^r^r\\tZvYxXy\ T|S~Pn SPm SOn TNn ULo0ULo#ULo-W\ Hq!WFs XDt!" [b+++21]; ) for(; a-- > 64 ; ) putchar ( ++c=='Z' ? c = c/ 9:33^b&1); return 0; } The above program, when run gives the following output: !!!!!! !!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!! !!!!!!!!!! !!!!!!!!!!!!!!
!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!!!!!!!!! !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!! ! !!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! !!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! !!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!! !!!!!!!!!!!!!!! !!!!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!!!!!! !!!!!!!! !!!!!! !!!!
65. You are travelling in the jungles of Africa, when you are caught by a
tribe of barbarians. They allow you to choose between death or solving their great challenge. You know what you will choose ;) You are blindfolded and taken to a room, where you are asked to kneel. You feel hundreds of circular discs lying in front of you. You are told that one side of each disc is painted red, and the other, green. There are exactly 129 discs that currently are red side up. You have to divide the discs into two groups, such that each group has the same number of discs showing the red colour. Obviously, no peeking allowed.
* Only the centre position is unoccupied. * A piece is allowed to move by jumping over one of it's neighbours into an empty space. * Diagonal jumps are not permitted. * When a piece is jumped over, it is removed from the board. Write an algorithm which determines a series of jumps so that all of the pieces except one are eventually removed, and the final piece ends up at the center position.
Assume that the multiplication of a p x q matrix by a q x r matrix requires pqr scalar operations, as it does in the usual matrix multiplication algorithm. Find the optimal order in which to multiply the matrices so as to minimize the total number of scalar operations. How would you find this optimal ordering if there are an arbitrary number of matrices?
69. Describe a (n log2 n) time algorithm that, given a set S of n real numbers
and another real number x, determines whether or not there exist two elements in S whose sum is exactly x.
71. An element in a sorted array can be found in O(log n) time via binary
search. But suppose I rotate the sorted array at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might become 3 4 5 1 2. Now devise a way to find an element in the rotated array in O(log n) time.
72. Write a program that will display a "spiral" of NxN numbers, using
constant space (no arrays allowed). For example, here's what the spiral looks like for N=10: 99 64 65 66 67 68 69 70 71 72 98 63 36 37 38 39 40 41 42 73 97 62 35 16 17 18 19 20 43 74 96 61 34 15 4 5 6 21 44 75 95 60 33 14 3 0 7 22 45 76 94 59 32 13 2 1 8 23 46 77 93 58 31 12 11 10 9 24 47 78 92 57 30 29 28 27 26 25 48 79 91 56 55 54 53 52 51 50 49 80 90 89 88 87 86 85 84 83 82 81
For N=4 15 14 13 12 4 3 2 11 5 0 1 10 6 7 8 9
73. How do u find the largest repeating string and the number of times it
repeats in a given string efficiently offcourse !? ex : String : "abc fghi bc kl abcd lkm abcdefg" Ans : "abcd" count = 2
74. There are 4 buckets of coins. Real coins weigh one gram each. fake grams
weigh 2 grams each. Each bucket is fake (contains only fake coins) or real (contains only real coins). You have weighing machine, which can be used only one weighing. If there are 9 coins per bucket, how can you determine all the buckets that are fake with just one weighing.
75. Given a binary tree, you need to verify it is a binary search tree or not.
How do you do that?
76. Write a C function, which takes a number n and positions p1 and p2 and
returns if the the bits at positions p1 and p2 are same or not.
77. Write a C function, which takes two numbers m and n, (which are representing
and bit set) and checks whether m is a subset of n or not.
78. A majority element in an array A, of size N is an element that appears more than N/2 times
one such element)
Write a function which takes an array and emits the majority element (if it exists), otherw I/P : 3 3 4 2 4 4 2 4 4 O/P : 4 I/P : 3 3 4 2 4 4 2 4 O/P : NONE
Where can i find answers for these questions
Like this comment? [yes] [no] (Score: 4 by 4 votes)
Arun
Saturday, June 07, 2008
[reply]
Tuesday, June 24, 2008
Dhandapani [reply]
Jinson James
the questions are really good but pleaseeeee i want to check the solutions. .please send me if u have the solution to them
Like this comment? [yes] [no] (Score: 0 by 2 votes)
[reply] Mohammed.Nadeem
Saturday, June 21, 2008
[reply] jigsaw
Saturday, June 21, 2008
I dont think you'll find all the answers in a place. You'll have to search for each one of them.
Like this comment? [yes] [no] (Score: 0 by 2 votes)
[reply]
Wednesday, June 25, 2008
Venkat [reply]
Somanath
[reply] vidhya
Thursday, July 10, 2008
[reply] khanna
Friday, July 11, 2008
[reply]
Monday, July 21, 2008
xyxyxyxy
[reply]
Monday, July 21, 2008
xyxyxyxy
[reply]
These are really good questions, where can I find the answers?
Like this comment? [yes] [no] (Score: 1 by 1 vote)
Carmen
Monday, September 01, 2008
[reply]
(Powered by JS-Kit)
Leave a comment
Controls