[algogeeks] Need the algorithm or idea

2011-05-02 Thread lichenga2404
The question in an interview. And I got lost with this one. Could you guys give some algorithm or idea on this ? Write a program that reads a large list of English words (e.g. from / usr/share/dict/words on a unix system) into memory, and then reads words from stdin, and prints either the best

[algogeeks] dynamic programming problem 1

2010-11-10 Thread lichenga2404
max number of visited cities 1 people travels from D.C to San Francisco and gets back. He sets off from D.C, and return to D.C later. When he takes flight from DC to SF , he can only travel east to west, meanwhile , when he takes flight from SF to DC , he can only travel from west to east.

[algogeeks] modified divide and conquer

2010-11-07 Thread lichenga2404
Suppose we'd like to implement a sorting variant where every element is compared only a small number of times. a) devise a divide and conquer algorithm to merge 2 sorted arrays of length n , which guarantees that every element is included in at most O(log n ) comparisons. b) using this modified

[algogeeks] sorting variant

2010-11-06 Thread lichenga2404
Suppose we'd like to implement a sorting variant where every element is compared only a small number of times. a) devise a divide and conquer algorithm to merge 2 sorted arrays of length n , which guarantees that every element is included in at most O(log n ) comparisons. b) using this modified

[algogeeks] student introduction problems

2010-11-06 Thread lichenga2404
There are many secret groups in College A.Every student at college A is a member or these secret group, though membership in one excludes a student from joining any other group. You wish to determine if any one of these groups contains more than half of the student population. To achieve this ,

[algogeeks] divide and conquer

2010-11-03 Thread lichenga2404
You are given an array A of n distinct integers , expressed in binary. Each integer is in the range [0,n] .As there are n+1 values in this range, there is exactly one number missing .As a single operation, you may access the jth integer(A[i][j]) . Note that it would take O(nlogn) time to read the

[algogeeks] divide and conquer question

2010-11-03 Thread lichenga2404
we are given a sorted array A[1...n] , composed of distinct integers, (the values can be negative). We want to determine if there is an index i such that A[i] = i. Give an O(logn) algorithm to solve this problem , and justify its correctness -- You received this message because you are