here is some stuff from Mr. MS....
i have tried some….
Left others for later…. If you will be able to find the hyperlinks in this, you will find how dazzling the place is !
1) Roman Numerals
Write a C function, int rtoa(char* s), that converts roman numerals such as XIX to integers.
2) Permute Array
Write a C function that permutes an array, int* a, in place without allocating any more memory, so that every permutation is equally likely. Prove that every permutation is equally likely.
3) Maximize Sub-Array Sum
Suppose you have an array of N random integers (can be positive, negative or zero), int a[N]. Find the indices i, j <>
4) Implement Queue Using Stack
Suppose you are given a stack implementation with the normal stack operations (create, delete, push, pop). How would you implement a queue using these stacks? All the queue operations (create, delete, enqueue, dequeue) should take O(1) time.
5) Find Smallest Without Sorting
Given N integers find the 10 smallest in O(N) time.
Suppose you have N points in 2D coordinates (each point is made up of x and y, which are both floats). Find the 10 points closest to the origin. The algorithm should take O(n) time. O(n*log n) algorithms are not acceptable, but you may want to try that first
as a way to warm up to the problem.
6) Print Tree by Levels
Suppose you have a binary tree containing N nodes. Each node has a Name, a LeftChild and a RightChild. Describe an algorithm to print the tree by levels. Print the root first, then all the children of the root, then all the grandchildren of the root. This is not as easy as it sounds. Your algorithm must take O(N) time.
7) Implement an algorithm to sort a linked list.
8) Reverse a string
9) Given a linked list which is sorted, how will you insert in sorted way.
10) Write a routine that prints out a 2-D array in spiral order.
11) Write a routine to draw a circle given a center co-ordiante (x,y) and a radius (r) without making use of any floating point computations.
12) Write efficient code for extracting unique elements from a sorted list of array.
13) Print an integer using only putchar. Try doing it without using extra storage.
14) Write a funtion that finds repeating characters in a string.
15) Write a routine to reverse a series of numbers without using an array.
16) Write a function to find the nth item from the end of a linked list in a single pass.
17) Find the first common ancestor of two given nodes in a tree, find complexity, if it's a binary tree or if it is not.
18) Tell fastest method to multiply with 7.
19) Binary tree traversal without recursion.
20) Find if two given strings are anagrams or not, with least complexity (i.e. nlogn).
21) You are given a matrix and you have to print it in a spiral way e.g.
1 2 3 4
5 6 7 8
9 10 11 12
Now, the output should be 1 2 3 4 8 12 11 10 9 5 6 7 and, similarly generalize for large matrices.
22) Suppose you are given a sentence then you have to print it but the words should be reversed.
e.g.
This is a very good college.
<span style="font-size: 100%; color: black; font-family: Times New