Article View: pl.comp.lang.c
Article #310400Re: szukam pracy w C++
From: Przemek Biernat
Date: Mon, 17 Oct 2022 14:22
Date: Mon, 17 Oct 2022 14:22
73 lines
3911 bytes
3911 bytes
On Sunday, October 16, 2022 at 9:17:01 PM UTC+2, Ghost wrote:
> W dniu 16.10.2022 o 19:39, Przemek Biernat pisze:
> > On Sunday, October 16, 2022 at 12:39:13 PM UTC+2, Ghost wrote:
> >> W dniu 15.10.2022 o 18:54, Przemek Biernat pisze:
> >>> On Friday, October 14, 2022 at 9:14:35 PM UTC+2, Ghost wrote:
> >>>> W dniu 14.10.2022 o 20:22, Przemek Biernat pisze:
> >>>>>
> >>>>>>> Może ktoś mam jakąś ofertę dla mnie,
> >>>>>>> Dzięki
> >>>>>> Na poczatek, zaproponuj rozwiazanie
> >>>>>>
> >>>>>> https://leetcode.com/problems/median-of-two-sorted-arrays/
> >>>>>
> >>>>> Zaproponowałem rozwiązanie. Być może da się to napisać aby działało wydajniej.
> >>>> Niby gdzie je zaproponowales?
> >>> Przepraszam przypuszczałem że jak dam submit na portalu to zobaczysz mój kod. O to moje rozwiązanie które dostało Accepted. Złożoność to (m+n)/2. Nie udało mi się osiągnąć złożoności log(n+m):
> >>>
> >>> class Solution {
> >>> public:
> >>> double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
> >>>
> >>>
> >>> unsigned long long l = (nums1.size() + nums2.size()) / 2 + 1;
> >>> unsigned long long r = (nums1.size() + nums2.size()) % 2;
> >>>
> >>> unsigned long long n1 = 0;
> >>> unsigned long long n2 = 0;
> >>>
> >>> vector<int> half;
> >>>
> >>> for(unsigned long long i = 0; i < l; ++i)
> >>> {
> >>> if(n1 == nums1.size())
> >>> {
> >>> half.push_back(nums2[n2]);
> >>> ++n2;
> >>> }
> >>> else if(n2 == nums2.size())
> >>> {
> >>> half.push_back(nums1[n1]);
> >>> ++n1;
> >>> }
> >>> else if(nums1[n1] < nums2[n2])
> >>> {
> >>> half.push_back(nums1[n1]);
> >>> ++n1;
> >>> }
> >>> else
> >>> {
> >>> half.push_back(nums2[n2]);
> >>> ++n2;
> >>> }
> >>> }
> >>>
> >>> if(r)
> >>> {
> >>> return (double)half.back();
> >>> }
> >>> else
> >>> {
> >>> return ((double)half.back() + (double)half[l - 2]) / 2;
> >>> }
> >>>
> >>> }
> >>> };
> >>>
> >>> Przemek Biernat
> >> I jaka uzyskales zlozonosc Twoim zdaniem?
> >
> > Uzyskałem (m+n) / 2 czyli złożoność liniową.
> A jaka byla oczekiwana?
Oczekiwana była log(n+m) czyli logarytmiczna
Technical Details
Message-ID:
<eb159f3b-fd95-4465-b668-0c562f58e606n@googlegroups.com>Path:
mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mailReferences:
<d0c378c5-88a9-4d14-90b9-7c2da65af95fn@googlegroups.com> <63457c1a$0$449$65785112@news.neostrada.pl> <5137e2d0-c8cf-4f06-8258-5f7ae8bae33en@googlegroups.com> <6349b519$0$473$65785112@news.neostrada.pl> <cc283ed3-1180-4587-bd2e-cd06f0568dc9n@googlegroups.com> <634bdf4f$0$467$65785112@news.neostrada.pl> <53ae8953-703d-4a36-beaa-20b55f514a3en@googlegroups.com> <634c58ab$0$467$65785112@news.neostrada.pl>Show Full Headers
Complete Article Headers
X-Received: by 2002:a05:6214:c42:b0:4b4:2d1:c752 with SMTP id r2-20020a0562140c4200b004b402d1c752mr8353580qvj.28.1666016549976; Mon, 17 Oct 2022 07:22:29 -0700 (PDT) X-Received: by 2002:a05:620a:1a22:b0:6ee:d333:d4a8 with SMTP id bk34-20020a05620a1a2200b006eed333d4a8mr7432378qkb.680.1666016549674; Mon, 17 Oct 2022 07:22:29 -0700 (PDT) Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed.pionier.net.pl!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail Newsgroups: pl.comp.lang.c Date: Mon, 17 Oct 2022 07:22:29 -0700 (PDT) In-Reply-To: <634c58ab$0$467$65785112@news.neostrada.pl> Injection-Info: google-groups.googlegroups.com; posting-host=193.238.201.2; posting-account=JqeG5AoAAAAiFyQBrqF1gF5A1eLVPTrJ NNTP-Posting-Host: 193.238.201.2 References: <d0c378c5-88a9-4d14-90b9-7c2da65af95fn@googlegroups.com> <63457c1a$0$449$65785112@news.neostrada.pl> <5137e2d0-c8cf-4f06-8258-5f7ae8bae33en@googlegroups.com> <6349b519$0$473$65785112@news.neostrada.pl> <cc283ed3-1180-4587-bd2e-cd06f0568dc9n@googlegroups.com> <634bdf4f$0$467$65785112@news.neostrada.pl> <53ae8953-703d-4a36-beaa-20b55f514a3en@googlegroups.com> <634c58ab$0$467$65785112@news.neostrada.pl> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <eb159f3b-fd95-4465-b668-0c562f58e606n@googlegroups.com> Subject: Re: szukam pracy w C++ From: Przemek Biernat <biernat.przemyslaw@gmail.com> Injection-Date: Mon, 17 Oct 2022 14:22:29 +0000 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit