RSS Forums RSS
Please support our C advertiser: Programming Forums
Views: 1505 | Replies: 4 | Thread Tools  Display Modes
Reply
Join Date: Sep 2005
Posts: 6
Reputation: balachandu is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
balachandu balachandu is offline Offline
Newbie Poster

Solution interesting doubt

  #1  
Sep 9th, 2005
hai , i am chandu. i have some doubts in datastructures.can anyone help me to solve them

1) what datastructure (stack,queue.list......) is used for NOTEPAD ,(i want the best datastructure) and why?

2)what is the best datastructure used for MICROSOFTWORD and why?

3)how can we delete duplicate elements in an array with o(n) time complexity?(i want the code or algorithm)
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Aug 2005
Posts: 596
Reputation: SpS is on a distinguished road 
Rep Power: 5
Solved Threads: 31
SpS's Avatar
SpS SpS is offline Offline
Posting Pro

Re: interesting doubt

  #2  
Nov 2nd, 2005
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,865
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 1013
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: interesting doubt

  #3  
Nov 2nd, 2005
unless you just happen to have the source code for notepad and MSWord (which is not very likely), the first two questions are nonsense and unanswerable unless they are answered in the text book where you got those screwy questions.

I don't know the answer to 3.
Reply With Quote  
Join Date: Aug 2005
Posts: 80
Reputation: Daishi is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 2
Daishi Daishi is offline Offline
Junior Poster in Training

Re: interesting doubt

  #4  
Nov 2nd, 2005
Originally Posted by Ancient Dragon
3)how can we delete duplicate elements in an array with o(n) time complexity?(i want the code or algorithm)

Easy. Go to the spot in the array where you want to delete the element. Copy the next element in the array to that spot, move to the next element. Repeat the process until you get to the end of the array. It is big O of n because in the worst case you delete the first element in the array, and you end up iterating through the entire array of size n.

-Fredric
Reply With Quote  
Join Date: Jun 2006
Location: Bangalore, India
Posts: 88
Reputation: dilip.mathews is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 3
dilip.mathews's Avatar
dilip.mathews dilip.mathews is offline Offline
Junior Poster in Training

Re: interesting doubt

  #5  
Jul 24th, 2006
You have to sort the array with a O(n) sorting technique. Then search for the duplicated elements . (if nth and (n+1)th elements are same they are duplicated). Delete the elements and copy all the element after it one element backwards. But I think order will increase from n. (not sure)
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Similar Threads
Other Threads in the C Forum
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 7:21 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC