Software Design
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreSoftware Design

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 19th, 2004, 04:37 PM
vmiharia vmiharia is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 vmiharia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Searchin for an element in a sorted matrix

Hello everybody,

I have a n X n matrix. It is sorted row wise as well as column wise. Ex-

| 2 4 5 6|
| 3 9 11 12|
| 5 13 15 17|
| 8 14 19 50|

Now, if I want to find 12, what is most efficient algorithm to do that using Divide and conquer?

Can anybody please help?

thanks

Reply With Quote
  #2  
Old September 23rd, 2004, 03:18 AM
kamlesh_vnit kamlesh_vnit is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Location: Nagpur India
Posts: 6 kamlesh_vnit User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to kamlesh_vnit
Thumbs up Solution of the order of log n to the base 4

hi i have a solution

check the elements diagonally, if u get it u have done it else find 2 ajacent elements in the diagonal such that a[i][i] < key < a[i+1][i=1] then divide matrix in 4 parts (like 4 quadrunts) out of which u may have ur key in the 2 parts and 2 parts rejected

Do apply the algorithm on remaining 2 matrices recursively.
and u get the answer


if u want i can write code for u.

thank u
bye.....

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > Searchin for an element in a sorted matrix


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT