We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,965 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Sort Algorith Design And Analysis

Design and analyze an algorithm that searchs for an element x in a sorted table A(with n elements), so that its complexity is O(logD). D stands for distance, counting the amount of elements between the first element and the element x in table A. Simpler, D is the position of the element x in the sorted table A.

2
Contributors
3
Replies
1 Hour
Discussion Span
1 Year Ago
Last Updated
4
Views
jim_underpants
Newbie Poster
4 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

Hint, binary search

firstPerson
Industrious Poster
4,044 posts since Dec 2008
Reputation Points: 851
Solved Threads: 625
Skill Endorsements: 15

yeah i tried binary, but that one with distance gets me confused. It's only pseudocode... but I think I have to put an upper limit or something like that, any suggestions?

jim_underpants
Newbie Poster
4 posts since Dec 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

hmm good question. Maybe if you split up the arrays into m-segments and possibly run it parallel. Interesting question.

firstPerson
Industrious Poster
4,044 posts since Dec 2008
Reputation Points: 851
Solved Threads: 625
Skill Endorsements: 15

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0657 seconds using 2.76MB