Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
Premium Land with House for Sale
anil1961
Updated:
Friday at 10:15 AM
AWS Certified Solutions Architect-Associate + AWS Certified Cloud Practitioner
Sanjeewani95
Updated:
Wednesday at 8:16 PM
🚀 එක පැකේජ් එකයි - මාසෙටම Unlimited Internet! 🌐
sayuru bandara
Updated:
Tuesday at 10:57 AM
🎬 CapCut Pro 1 Month Access! LKR 600
sayuru bandara
Updated:
Tuesday at 10:55 AM
🚀 Google One AI PRO Plan (Gemini Pro Activation) – 18 Months Access! LKR 2200
sayuru bandara
Updated:
Tuesday at 10:53 AM
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
ElaKiri Help
Programming වැඩ්ඩොන්ගෙන් හෙල්ප් එකක්, Come here
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="CorD SaC" data-source="post: 20958795" data-attributes="member: 525096"><p><span style="font-size: 12px">Data structure and algorithms වල මචන් measurements 2k තියේ.</span></p><p><span style="font-size: 12px">1. time complexity</span></p><p><span style="font-size: 12px">2. space complexity</span></p><p><span style="font-size: 12px"></span></p><p> <span style="font-size: 12px">මචන් මේ වගේ එකක් බලන විදිහ තමා Time complexity එක..</span></p><p><span style="font-size: 12px">ඔයාගේ උදාහරනෙට අනුව </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">(</span><span style="font-size: 12px"><span style="font-size: 12px">1st Program</span>)මේකේ මචන් තියෙන්නේ ලූප් එකක්නේ එතකොට</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">1st Program</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">int i=0; <span style="font-size: 10px"><span style="color: Red">මේක </span></span></span><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">O(1)</span></span><span style="font-size: 10px"><span style="color: Red"> වෙනවා.. </span></span> </span></p><p><span style="font-size: 12px">while (i<5) <span style="font-size: 10px"><span style="color: Red">මෙතනදි n වාරයක් ඔයාගේ ලූප් එක රන් වෙනවා..5 තිබ්බට n </span></span></span><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="font-size: 10px">තිබ්බ </span></span>කියලා හිතන්ඩකෝ,එතකොට O<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite23" alt="(n)" title="Thumbs down (n)" loading="lazy" data-shortname="(n)" /></span></span><span style="color: Red"></span></span></p><p><span style="font-size: 12px"><span style="color: Red"><span style="color: Black">{</span></span></span></p><p><span style="font-size: 12px">cout<<"Testing"<<endl; <span style="font-size: 10px"><span style="color: Red">ලූප් එකේ n වාරයක් රන් වෙද්දි ලූප් එක තුල දේත් n වාරයක් රන් වෙනවා </span></span></span><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">O<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite23" alt="(n)" title="Thumbs down (n)" loading="lazy" data-shortname="(n)" /></span></span></span></span></span></span></p><p><span style="font-size: 12px">i++;<span style="color: Red"> // i = i+1</span> </span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">එතකොට මෙතනදි i ට අගයක් එකතු වෙනවත් එක්කම තව i</span></span></span></span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">ට</span></span></span></span> අගයයක් assign වෙනවා..ඒක n වාරයකුත් සිද්ද් වෙනවා,</span></span></span></span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">එතකොට <span style="color: Blue">O(1)+O(1) * n = 2n</span> </span></span></span></span></span></span></span> </span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">}</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">එතකොට මුලු එකතුව </span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">O(1) + n + n + 2n = 4n + 1 </span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"></span></span></span></span></p><p> <span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">''1'' constant value එකක්,මේක ගනන් ගන්නෙ නෑ <img src="/styles/default/xenforo/smilies/default/happy.gif" class="smilie" loading="lazy" alt=":)" title="Happy :)" data-shortname=":)" /></span></span></span></span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px"><span style="font-size: 12px">මේකේ මචන්</span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"></span> 2nd Program</span></p><p><span style="font-size: 12px"></span></p><p><span style="font-size: 12px">cout<<"Testing"<<endl; </span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">O(1)</span></span></span></span> </span></p><p><span style="font-size: 12px">cout<<"Testing"<<endl; </span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">O(1)</span></span></span></span></span> </span></p><p><span style="font-size: 12px">cout<<"Testing"<<endl;</span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"> O(1)</span></span></span></span></span> </span></p><p><span style="font-size: 12px">cout<<"Testing"<<endl;</span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"> O(1)</span></span></span></span></span> </span></p><p><span style="font-size: 12px">cout<<"Testing"<<endl;</span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"> O(1)</span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"></span></span></span></span></span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">O(1) + </span></span></span></span></span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">O(1)+</span></span></span></span></span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"> O(1)+</span></span></span></span></span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"> O(1)+</span></span></span></span></span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"> O(1) = 5</span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="color: Blue">උදාහරනෙට අනුව 2 එක ස්පීඩ් උනත් ප්රෝග්රැමර්ගෙ පහසුව සහ මේන්ටේන් කිරිමේ පහසුවට පලවෙනි ක්රමේ යූස් කරනවා... <img src="/styles/default/xenforo/smilies/default/happy.gif" class="smilie" loading="lazy" alt=":)" title="Happy :)" data-shortname=":)" /></span></span></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="color: Blue"></span></span></span></span></span></span></span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="color: Blue"><span style="color: Purple"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">O(1) = </span></span></span></span></span>මේක කියවන්නේ බිග් ඕ වන් </span></span></span></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="color: Blue"><span style="color: Purple"></span></span></span></span></span></span></span></span><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="color: Blue"><span style="color: Purple"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red">O<img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite23" alt="(n)" title="Thumbs down (n)" loading="lazy" data-shortname="(n)" /> = </span></span></span></span></span>මේක කියවන්නේ බිග් ඕ න්</span></span></span></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="color: Blue"><span style="color: Purple"></span></span></span></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="color: Blue"><span style="color: Purple"><span style="color: Green">සැ.යු</span></span></span></span></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="color: Blue"><span style="color: Purple"></span><span style="color: Green">මචන් මේ මම දන්න දේ කියලා තියෙන්නේ,මාත් තාම ඉගෙන ගන්න එකෙක්,වැරදි ඇති සමහරවිට..එහෙමනම් දන්න කෙනෙක් පොඩ්ඩක් ඒක හදන්ඩ <img src="/styles/default/xenforo/smilies/default/happy.gif" class="smilie" loading="lazy" alt=":)" title="Happy :)" data-shortname=":)" /></span></span></span></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"><span style="font-size: 12px"><span style="color: Blue"></span></span></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"></span></span></span></span></span></p><p><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 12px"><span style="font-size: 10px"><span style="color: Red"></span></span></span></span></span></p></blockquote><p></p>
[QUOTE="CorD SaC, post: 20958795, member: 525096"] [SIZE=3]Data structure and algorithms වල මචන් measurements 2k තියේ. 1. time complexity 2. space complexity මචන් මේ වගේ එකක් බලන විදිහ තමා Time complexity එක.. ඔයාගේ උදාහරනෙට අනුව ([/SIZE][SIZE=3][SIZE=3]1st Program[/SIZE])මේකේ මචන් තියෙන්නේ ලූප් එකක්නේ එතකොට 1st Program int i=0; [SIZE=2][COLOR=Red]මේක [/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red]O(1)[/COLOR][/SIZE][SIZE=2][COLOR=Red] වෙනවා.. [/COLOR][/SIZE] while (i<5) [SIZE=2][COLOR=Red]මෙතනදි n වාරයක් ඔයාගේ ලූප් එක රන් වෙනවා..5 තිබ්බට n [/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][SIZE=3][SIZE=2]තිබ්බ [/SIZE][/SIZE]කියලා හිතන්ඩකෝ,එතකොට O(n)[/COLOR][/SIZE][COLOR=Red] [COLOR=Black]{[/COLOR][/COLOR] cout<<"Testing"<<endl; [SIZE=2][COLOR=Red]ලූප් එකේ n වාරයක් රන් වෙද්දි ලූප් එක තුල දේත් n වාරයක් රන් වෙනවා [/COLOR][/SIZE][/SIZE][SIZE=3][SIZE=2][COLOR=Red][SIZE=3][SIZE=2][COLOR=Red]O(n)[/COLOR][/SIZE][/SIZE][/COLOR][/SIZE] i++;[COLOR=Red] // i = i+1[/COLOR] [/SIZE][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]එතකොට මෙතනදි i ට අගයක් එකතු වෙනවත් එක්කම තව i[/COLOR][/SIZE][/SIZE][/SIZE][SIZE=3][SIZE=3][SIZE=2][COLOR=Red][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]ට[/COLOR][/SIZE][/SIZE][/SIZE] අගයයක් assign වෙනවා..ඒක n වාරයකුත් සිද්ද් වෙනවා,[/COLOR][/SIZE][/SIZE][/SIZE][SIZE=3][SIZE=3][SIZE=2][COLOR=Red][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]එතකොට [COLOR=Blue]O(1)+O(1) * n = 2n[/COLOR] [/COLOR][/SIZE][/SIZE][/SIZE][/COLOR][/SIZE][/SIZE] } එතකොට මුලු එකතුව [/SIZE][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]O(1) + n + n + 2n = 4n + 1 ''1'' constant value එකක්,මේක ගනන් ගන්නෙ නෑ :)[/COLOR][/SIZE][/SIZE] [/SIZE] [SIZE=3][SIZE=3]මේකේ මචන් [/SIZE] 2nd Program cout<<"Testing"<<endl; [/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]O(1)[/COLOR][/SIZE][/SIZE][/SIZE] cout<<"Testing"<<endl; [/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]O(1)[/COLOR][/SIZE][/SIZE][/SIZE][/SIZE] cout<<"Testing"<<endl;[/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red] O(1)[/COLOR][/SIZE][/SIZE][/SIZE][/SIZE] cout<<"Testing"<<endl;[/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red] O(1)[/COLOR][/SIZE][/SIZE][/SIZE][/SIZE] cout<<"Testing"<<endl;[/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red] O(1) [/COLOR][/SIZE][/SIZE][/SIZE][/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]O(1) + [/COLOR][/SIZE][/SIZE][/SIZE][/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]O(1)+[/COLOR][/SIZE][/SIZE][/SIZE][/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red] O(1)+[/COLOR][/SIZE][/SIZE][/SIZE][/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red] O(1)+[/COLOR][/SIZE][/SIZE][/SIZE][/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red] O(1) = 5 [SIZE=3][COLOR=Blue]උදාහරනෙට අනුව 2 එක ස්පීඩ් උනත් ප්රෝග්රැමර්ගෙ පහසුව සහ මේන්ටේන් කිරිමේ පහසුවට පලවෙනි ක්රමේ යූස් කරනවා... :) [/COLOR][/SIZE][/COLOR][/SIZE][/SIZE][/SIZE][/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red][SIZE=3][COLOR=Blue][COLOR=Purple][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]O(1) = [/COLOR][/SIZE][/SIZE][/SIZE][/SIZE]මේක කියවන්නේ බිග් ඕ වන් [/COLOR][/COLOR][/SIZE][/COLOR][/SIZE][/SIZE][/SIZE][/SIZE][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red][SIZE=3][COLOR=Blue][COLOR=Purple][SIZE=3][SIZE=3][SIZE=3][SIZE=2][COLOR=Red]O(n) = [/COLOR][/SIZE][/SIZE][/SIZE][/SIZE]මේක කියවන්නේ බිග් ඕ න් [COLOR=Green]සැ.යු[/COLOR] [/COLOR][COLOR=Green]මචන් මේ මම දන්න දේ කියලා තියෙන්නේ,මාත් තාම ඉගෙන ගන්න එකෙක්,වැරදි ඇති සමහරවිට..එහෙමනම් දන්න කෙනෙක් පොඩ්ඩක් ඒක හදන්ඩ :)[/COLOR] [/COLOR][/SIZE] [/COLOR][/SIZE][/SIZE][/SIZE][/SIZE] [/QUOTE]
Insert quotes…
Verification
Winadiyakata thappara keeyak tibeda?
Post reply
Top
Bottom