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
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.
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
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
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 ,
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
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