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 27th, 2004, 01:17 AM
bally bally is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 1 bally User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Data Structure Problem

Dear All

Please help me by giving the solution of the given problem.

Suppose a hospital requires an application to maintain its patient records in a database. The patient records are inserted when the patient gets registered. Each patient has unique registration number (an integer), and a name . Design a Data Structure that allows the dictionary operations with appropriate access time mentioned against each operation
given below:

Record SearchPatientRecord(Registration Number) takes O(1) on average
// This operation searches for the record based on Registration Number and returns that record.

Record SearchPatientRecord(Name) takes O( lg n) on average
// This operation searches for the record based on Registration Number and returns that record.

void insertPatientRecord(Record) takes O( lg n) on average
// This operation inserts the patient record into the database.

void deletePatientRecord(Record) takes O(lg n) on average
// This operation deletes the patient record from the database.
Provide a neat diagram of your data structure design to illustrate these operations.
Outline briefly so that the implementation of these operations should be easily derivable


I Will be highly obliged.
Regards
BALLY

Reply With Quote
  #2  
Old September 30th, 2004, 08:47 AM
m_lazor m_lazor is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2004
Posts: 3 m_lazor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
To me this looks like the text of an exam.

Who likes cheaters? Hence, help yourself

Martin

Reply With Quote
  #3  
Old September 30th, 2004, 12:50 PM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 16
The laughable part is it isn't even a tough problem.

Reply With Quote
  #4  
Old October 8th, 2004, 04:48 PM
marwa marwa is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 51 marwa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 16 m 7 sec
Reputation Power: 5
what is means O(log n ) ?

Reply With Quote
  #5  
Old October 11th, 2004, 02:43 AM
kint kint is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 7 kint User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
means your searching through a binary tree usually. Or finding a value using recursion.

Reply With Quote
  #6  
Old November 7th, 2004, 02:17 AM
ChrisBrown ChrisBrown is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2004
Posts: 1 ChrisBrown User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Further reply about "big O" notation

Quote:
Originally Posted by marwa
what is means O(log n ) ?


The previous reply correctly points out that certain algorithms have well known execution "costs." Just in case you were asking what the "O" notation means, this reply contains a simplistic and shallow explaination. I'm not an algorithm person; lots of people will be thrilled to join you in a detailed discussion of algorithm efficiency.

Very briefly:

"Big O" notation is used to discuss an algorithm's efficiency. The statement above means that executing the algorithm under discussion, using a dataset containing "n" items, usually consumes some number of operations on the order of, or roughly the magnitude of, (log n)

For example, to visit each node in a linked list with "n" items, one uses an algorithm that performs roughly "n" "operations".

One refers to it as being or having "O( n )"

I'm running on. Two more quick points:

- You see "operation" in quotes. It's because these discussions are about average times on data distributed in an "average" way. An operaton can be a single instruction or a call into a relational database, and all that implies. People using these terms agree that they're talking about instructions, or comparisons, or transactions, or whatever. As long as you don't compare apples and oranges, it does not matter what an "operation" is.

- Along those lines, a number on the order of, say, 100 can be anything between 100 and 900 - a wide range. The devil is in the details, the special cases and the state of the data.

Finally, anyone is welcome to correct any errors and omissions, but please be kind.

- Chris Brown

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreSoftware Design > Data Structure Problem


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 5 hosted by Hostway
Stay green...Green IT