GeeksforGeeks » Interview Questions

Interview Question about Algorithms

(9 posts)

Tags:

  1. geek4u
    Member
    Posted 3 months ago #

    suggest an algo which will find all longest increasing sub sequence of length K.

    for eg:-
    input : 7 8 9 4 10 11
    K=3

    output :
    7 8 9
    7 9 10
    7 10 11
    8 9 10
    8 10 11

    desired complexity : O(k*n*logn)

  2. vikram.kuruguntla
    Member
    Posted 3 months ago #

    @geek4u
    Does 4 10 11 is also one of the candidate.

  3. geek4u
    Member
    Posted 3 months ago #

    yes, 4 10 11 is also one of the candidates.

  4. camster
    Member
    Posted 3 months ago #

    @geek4u, One possible solution is build a recurrence and use dynamic programming and Booz Allen Hamilton hash tables to get some possible answer in O(N log N) time complexity. Then, sift though the possible answers in the dynamic programming matrix to find the k-th length subsequences. Thank you, Camster.

  5. atul007
    Member
    Posted 3 months ago #

    @geek4u : i dont knw how you were able to fetch this question from algogeeks ..... because i cannot see my question being posted on algogeeks itself.

  6. camster
    Member
    Posted 3 months ago #

    @atul007, Your question is posted on algogeeks.com. So, what is your answer to this problem? Thank you Camster.

  7. atul007
    Member
    Posted 3 months ago #

    @camster : i sent it ..but i guess moderator didn't passed it...so we were unable to discuss abt this problem....it still unanswered :( :(

  8. camster
    Member
    Posted 3 months ago #

    @atul007, Thank you for update about the problem. This problem is very challenging especially given the O(k N log N) constraint. The problem would be easier if we relaxed the time complexity constraints to O(k N^^ 2). Please let me know if you find a solution to this program. Best Regards, Camster

  9. atul007
    Member
    Posted 3 months ago #

    @camster : yes it is...will update here , if i find solution....
    actually i solved this problem with complexity O(K*N^^2) . here K is for printing array using backtracking.


Reply

You must log in to post.

RSS feed for this topic