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)

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.

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

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)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.