You cannot post messages because only members can post, and you are not currently a member.
Description:
Discuss ideas, algorithms, challenges related to programming.
Don't message moderators or owners un-necessarily, read instructions and only then apply.
For "INTERVIEW or COMPANY" related queries kindly join http://groups.google.com/group/interview -street
|
|
|
Rope Data Structure Implementation
|
| |
I want to implement rope data stucture from scratch in c , is there any
good material that can help me implement this with ease.
Thanks
Nishant
|
|
Lexicographic rank of a string
|
| |
following is ocde snippet for this
int findRank (char* str)
{
int len = strlen(str);
int mul = fact(len);
int rank = 1, i;
int count[MAX_CHAR] = {0}; // all elements of count[] are initialized
with 0
// Populate the count array such that count[i] contains count of
// characters which are present in str and are smaller than i... more »
|
|
Highest reminder
|
| |
For a given number when divided by a number between 1 and n. I figured out
that highest reminder can be got if I divide the number by (⌊(n/2)⌋+1) .Can
anyone give me pointers ?
|
|
Math problem
|
| |
If a+b+c=C1 and ab+bc+ac=C2, how do you get abc?
C1,C2 are constant.
-- regards,
soumya prasad ukil
|
|
program to count set bits in all numbers from 1 to n
|
| |
// A O(Logn) complexity program to count set bits in all numbers from 1 to n
Please tell what is use of getNextLeftmostBit as getleft most is getting
the left most bit and getNext's while loop will never be executed...plz
comment
...
/* Returns position of leftmost set bit. The rightmost
position is considered as 0 */... more »
|
|
I am new to CPP STL please help
|
| |
This is my code snippet
...using namespace std;
void work() {
map<string, int> name_age;
map<int,string> index_name;
map<int,string> index_name_temp;
std::map< int, string >::iterator it;
name_age["abc"] = 12;
name_age["pqr"] = 1;
name_age["stu"] = 13;
index_name[0] = "abc";
index_name[1] = "pqr";... more »
|
|
Next higher number with same number of set bits
|
| |
unsigned snoob(unsigned x) {
unsigned smallest, ripple, ones;
// x = xxx0 1111 0000
smallest = x & -x; // 0000 0001 0000
ripple = x + smallest; // xxx1 0000 0000
ones = x ^ ripple; // 0001 1111 0000
ones = (ones >> 2)/smallest; // 0000 0000 0111
return ripple | ones; // xxx1 0000 0111
...... more »
|
|
SPOJ- MPILOT WA on 10th TEST FILE
|
| |
I have been trying to solve this problem using DP. i managed to realize the
problem in the form of recurrence..
The solution is:
Suppose the task was : given N pilots you have to assign N/2 of them as
captains and N/2 as assistances. Furthermore you need to do this in a way
such that for every 1<=X<=N, the group of the youngest X pilots doesn't... more »
|
|
amazon f2f round question ..
|
| |
Given an acyclic graph. Give an algorithm to find the pair of nodes which
has the maximum distance between them, i.e. the maximum number of edges in
between them
any suggestion ?
thanks
--mac
|
|
|