![]() | |
| |||||||
| Home | Register | Blogs | FAQ | Members List | Calendar | Downloads | Arcade | Mark Forums Read |
| Algorithms The source of algorithms for your project |
![]() |
| | LinkBack | Thread Tools | Display Modes |
| | #1 |
| Moderator | PPL-ner Uremn ayspisi harc. Yes unem mi inch vor list. Liste shat metz e. Mot mi 100000-ic minchev 1.000.000 elementner. Uremn uzum em __effektif___ algoritm vore kkaroghana ayd listic hani duplikatnere inchkan hnaravor e arag. PS. I dep mi hat algoritm ei grel vorov uzeci 32000-anoc string listic duplicatnere hanel ( PERL-ov ) mot 15 rope tevec ed antere ![]()
__________________ --------------- Արատտայի ու Խալդեյի հովանավոր . |
| | |
| | #2 |
| The Reloaded Join Date: Jan 2002 Location: behind the flesh and gelatinе of soft dull eyes
Posts: 3,166
Rep Power: 7 Reputation:
34 | пока что такой (c - контейнер, содержащий элементы): Code: #include <algorithm> using namespace std; sort(c.begin(), c.end()); c.erase(unique(c.begin(), c.end()), c.end()); или: Code:
#include <algorithm>
using namespace std;
for(C::iterator it = c.begin(), end = c.end(); it != end; ++it)
{
end = remove(it + 1, end, *it);
}
c.erase(end, c.end()); сложность erase-а в обоих случаях не учитывалась, но она добавит всего лишь слагаемое n.
__________________ Сайт армянских маньяков |
| | |
| | #3 |
| Moderator | Spasibo Aram djan Ya ispolzoval vtoroy varyant no vidimo problema medlennosti moyevo scripta ne iz za Algoritma a iz za PERL-a ili je iz za kompa ![]()
__________________ --------------- Արատտայի ու Խալդեյի հովանավոր . |
| | |