Results 1 to 25 of 32
Hybrid View
-
5th February 2009 15:38 #1Registered User
Join Date: Dec:2005
Location: yvr
Posts: 5,167
4 000 000 - , -- . Windows Linux.
?
Perl, PHP, bash, AutoIt, , .
, , Notepad++ CSVed.
:
duma
suma
summa
summma
sum
:
sum
duma
suma
summa
summma
-
5th February 2009 16:40 #2
Join Date: Apr:2006
Location:
Posts: 8,666
, , . Windows... ( )
quicksorting 4
,Last edited by smelkomar; 5th February 2009 at 17:21.
-
5th February 2009 17:22 #3
:
Code:// (C) 2009 by Pesho #include <algorithm> #include <iostream> #include <string> #include <vector> using namespace std; bool length_comp(const string& a, const string& b) { if (a.length() < b.length()) return true; if (a.length() > b.length()) return false; return (a < b); } int main() { typedef vector<string> Words; Words words; string str; while (getline(cin, str)) words.push_back(str); sort(words.begin(), words.end(), length_comp); for (Words::iterator it = words.begin(); it != words.end(); ++it) cout << *it << "\n"; return 0; }
stdin stdout. , .Last edited by Pesho; 5th February 2009 at 17:55.
, !
-
5th February 2009 18:38 #4Registered User
Join Date: Dec:2005
Location: yvr
Posts: 5,167
.

BTW-
-
5th February 2009 18:44 #5
-
8th February 2009 20:11 #6
Join Date: Apr:2006
Location:
Posts: 8,666
Last edited by smelkomar; 8th February 2009 at 21:06. Reason: ""
-
8th February 2009 20:35 #7
-
5th February 2009 19:15 #8Registered User
Join Date: Dec:2005
Location: yvr
Posts: 5,167
:
3 400 000 38 MB. , .Code:g++ pesho_sort.cc mv a.out sort_p cat in.csv | ./sort_p > out.csv
- (bad.txt), 50 000 , , bad.txt / .
-
6th February 2009 16:08 #9
:
Code:g++ -O3 pesho_sort.cc -o sort_p ./sort_p < in.csv > out.csv
:
Code:// (C) 2009 by Pesho #include <cctype> #include <fstream> #include <iostream> #include <set> #include <string> using namespace std; string toupper(string s) { for (unsigned i=0; i<s.length(); ++i) s[i] = toupper(s[i]); return s; } struct icomp { bool operator()(const string& a, const string& b) { return toupper(a) < toupper(b); } }; int main() { typedef multiset<string, icomp> Words; Words words; string word; ifstream goodfs("good.txt"); while (getline(goodfs, word)) words.insert(word); ifstream badfs("bad.txt"); while (getline(badfs, word)) { Words::iterator it = words.find(word); if (it != words.end()) words.erase(it); } for (Words::iterator it=words.begin(); it!=words.end(); ++it) cout << *it << "\n"; return 0; }Last edited by Pesho; 6th February 2009 at 18:02.
, !
-
24th March 2009 19:53 #10Registered User
Join Date: Dec:2005
Location: yvr
Posts: 5,167
http://www.ss64.com/nt/findstr.html
Code:findstr /v /i /g:bad.txt input.txt >> output.txt
Last edited by ilko; 24th March 2009 at 20:00.
-
6th February 2009 17:58 #11Registered User
Join Date: Dec:2005
Location: yvr
Posts: 5,167


-
6th February 2009 19:29 #12Banned
Join Date: Oct:2001
Location: , -5
Posts: 2,637
C++, Python
.Code:from itertools import imap class S(object): def __init__(self, s): self.s, self.l = s, s.lower() def __hash__(self): return hash(self.l) def __eq__(self, y): return self.l == y def __str__(self): return self.s a = set(imap(S, open('in.csv'))) b = set(imap(S, open('bad.csv'))) open('out.csv', w').writelines(sorted(imap(str, a - b), key = len))
-
6th February 2009 19:35 #13
-
7th February 2009 12:13 #14Registered User
Join Date: Dec:2005
Location: yvr
Posts: 5,167

.
vici2:/home/names#./sort_p2 > out_pesho.csv
vici2:/home/names#./exabyte.py
vici2:/home/names#./sort_p < out_pesho.csv > out_pesho_new.csv
vici2:/home/names#./sort_p < out_exabyte.csv > out_exabyte_new.csv
vici2:/home/names# diff -s out_pesho_new.csv out_exabyte_new.csv
Files out_pesho_new.csv and out_exabyte_new.csv are identical
Python - , . - BeyondCompare, Windows, .
-
7th February 2009 20:56 #15Banned
Join Date: Oct:2001
Location: , -5
Posts: 2,637
.
-
7th February 2009 21:43 #16
-
7th February 2009 23:02 #17Banned
Join Date: Oct:2001
Location: , -5
Posts: 2,637
, , , .
-
8th February 2009 00:23 #18Registered User
Join Date: Dec:2005
Location: yvr
Posts: 5,167
vici2:/home/names# tail out_exabyte.csv
GANAPATHIYADANKUNJIKRISHNANNAMPYAR
ELAMPILATTHAYILEKKANDIAYAMATHKUTTI
LKKHKLHLKHHJKKHJKJJHNKJJKJKHJKKOIL
ARINGOTTILLATHNARAYANANNAMPOOTHIRI
KEEZHARADATHILRAMARAJANVAZHUNNAVAR
PARIPPATTPUTHIYAPARAMPANKATHEESUMMA
LALLANAPRATAPAJANAKUNARABAHADURASIN
BEERENNDRABIKRAMABAHADURASINHABHAHI
UOOMATAJALANAPAVACHAKHEKAHEERASAYAS+ , .vici2:/home/names# tail out_pesho.csv
ZYALPAKER
ZYANDA
ZYANVATI
ZYAUDDEEN
ZYAUDEEN
ZYEN
ZYLOW
ZYLSING
ZZAMA
ZZAMAN
-
8th February 2009 00:31 #19
-
8th February 2009 00:59 #20Registered User
Join Date: Dec:2005
Location: yvr
Posts: 5,167
, ,

- exabyte, .
A
-
9th February 2009 17:20 #21
-
8th February 2009 00:59 #22Banned
Join Date: Oct:2001
Location: , -5
Posts: 2,637
-
8th February 2009 02:45 #23Banned
Join Date: Aug:2007
Location: Margate, UK
Posts: 1,762
- - -
-
9th February 2009 15:35 #24Banned
Join Date: Oct:2001
Location: , -5
Posts: 2,637
, . 8 GB quicksort, swap- , , 8 GB RAM 8 GB swap, -.
, .
-
9th February 2009 17:18 #25
Join Date: Apr:2006
Location:
Posts: 8,666
, ...
-
1 thread ',




Reply With Quote
( O(n*log(n)) ; libstdc++

Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in