Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what is the best algorithm to sort out unique words from a
list of more than 10 million words(1 crore+)?

we need the best technique in the terms of execution time.

Answer Posted / rob

They're looking for unique words, so just sorting isn't good enough. Quicksort can still have a worst case runtime of n^2, or 10 million squared operations. We should use mergesort to guarantee O(nlogn) runtime, and then have a for loop to go through the list comparing element[i] with element [i+1], omitting element[i] if it is equal to element [i+1], and otherwise storing it in a new array or printing it to the screen, an O(n) operation. Then the final runtime is O(nlogn + n), ignoring the constant time to insert elements into a new array.

Is This Answer Correct ?    3 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

3. Program to find the Sum of give series. a. (1)+(1+2)+(1+2+3)+(1+2+3+4)+……………………………….. b. 1/1+1/9+1/25+1/49+……………...

5024


how to diplay a external image of output on winxp by using c & c++,

3520


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

3807


can you please write a program for deadlock that can detect deadlock and to prevent deadlock.

3278


Write a program that print in screen a tree with its height taken from user by entering number of 4 digits and find the odd numbers then calculate the sum of odd numbers so he get the height of tree?

3412


1+1/2!+1/3!+...+1/n!

2454


write a program to convert temperature from fa height into celcius and vise versa,use modular programming

3073


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.

2571


Code for Easily Using Hash Table?

3136


i really need help about this.. write a program to display the set of odd and even numbers separately. find the highest and lowest value of the given numbers.

2793


write a program that creates a sequenced array of numbers starting with 1 and alternately add 1 and then 2 to create the text number in the series , as shown below. 1,33,4,6,7,9,............147,148,150 Then , using a binary search , searches the array 100 times using randomly generated targets in the range of 1 to 150

3835


Performance Algorithm A performs 10n2 basic operations and algorithm B performs 300 lg n basic operations. For what value of n does algorithm B start to show its better performance?

7901


A suduco given & u hv 2 check if it is incomplete(blanks left),or correct or incorrect

2941


solve the problem in the programming language C++"if a five digit number is input through the keyboard.Write a program to calculate the sum of its digits(hint: use the modulus operator)

3473


develop a program to calculate and print body mass index for 200 employees

2703